MINGW Development Package(MAC OS)

From Embedded Systems Learning Academy
Revision as of 19:51, 27 December 2016 by 243 user2 (talk | contribs) (Program the Hex file into SJOne board)

Jump to: navigation, search

This tutorial shows you how to compile a C/C++ program in Mac OS using Eclipse. Remember that GNU is the linux-based compiler and hence if we want to use it for Mac OS, we have to have certain executable(s) to be running in Mac OS.

Development Package

You can get the same development package as the one we promote for ARM processors.


Required Package

You might need to get and install the following package:

  • Command Line Tools


Open Eclipse and Create New Project

1. Open Eclipse.
   Always open the bash file
   since it sets up environment variables for you.

Open bash file in your development package directory

2. Open lpc1758_freertos Project

  • Right click on the lpc1758_freertos project
  • Choose Open Project
Open C++ Project


3. Write your source code
   Copy the simple source code on the right.

#include <stdio.h>

int main(void)
{
    /* Without this, printf() will not work */
    setvbuf(stdout, 0, _IONBF, 0);
    setvbuf(stdin,  0, _IONBF, 0);

    /* Write rest of your code here */
    printf("Hello World\n");
    return 0;
}

4. Run your program

  • Click on the the harmmer button and start building your code
  • build_with_dbc option will also generate the dbc file in _can_dbc directory
Run your project

Program the Hex file into SJOne board

1. Find USB path

  • Open Terminal from your Mac
  • Type "ls /dev/ | grep usbserial*"
Create New Eclipse C++ Project

2. Modify python script

  • Open the pyFlash-Hyperload.py
  • Find sDeviceFile and sHexFilePath
  • Replace these two path with your local device path and hex file path
Create New Eclipse C++ Project



3. Run External python tool from eclipse

  • Go to Run from the menu bar
  • Click External Tool -> python
Run your project

4. Program SJOne board

  • Run the following command on the python external tool
  • execfile("pyFlash-Hyperload.py")
Run your project