[Solved] Build firmware on MAC :-)

hello,
I am trying to compile and build the LXR on my MAC (10.8). I have some issues.

0- Did one of you succeed to compile the code on MAC?

Here are some step I did:
1- install CDT Eclipse , Kepler version.
2- install the Eclipse plug in (Eclipse GNU ARM plugin) ->  http://gnuarmeclipse.sourceforge.net/updates. Follow the steps as mentionned on this website:  uncheck one of the components called 'end of life'. it is mentionned in the install guide but i prefer to repeat it!

3- Download and install the GCC ARM toolchain for MAC:
http://gnuarmeclipse.livius.net/blog/toolchain-install/#OS_X
http://gnuarmeclipse.livius.net/blog/plugins-install/
http://gnuarmeclipse.livius.net/blog/toolchain-install/

4- Download and install Atmel AVR toolchain from http://www.obdev.at/products/crosspack/index.html -> similar to AVR studio
5- install and adapt to you system -> steakunderscore / arm-elf-gcc_on_osx.sh -> https://gist.github.com/steakunderscore/1039852

In fact I am not sure if step 3, 4 and 5 are right!!
can you help ?

cheers.

Comments

  • I'm interested in this too. (10.9) My LXR isn't here yet, but I'll be trying in a couple of weeks. Please update the thread if you get further! I develop iOS, Mac and Android, but have never tried this stuff yet.
    Cheers.
  • edited April 2014
    oki, i will.

    i prepared an "how to for mac" , but when i posted this thread , i did very very simple and "dirty" , i will update this thread with more details soon :-)
  • by the way, i am not as experienced as you in the MAC development :-( not so good with eclipse configuration, a nightmare for me, too many option in eclipse!
  • Yeah, eclipse is a bit of a nightmare!!!

    I got my LXR at the weekend and built it. Haven't had time to do much with it yet.
  • i am thinking to install a linux :-) on my virtual box, it seem easier to make the build :-)
  • Hello,
    this morning, I got this issue when building the firmware (see the screen shot)

    I have two issues:
    1- "cs-make" not found -> I guess its normal as I am on MAC .. but what should I should i use instead?
    2- Next, I have 4 warning about PATH... seems that windows path (C//) is still is the code?

    Can you help me?
    Thanks.


  • By the way for CS-MAKE, I found in eclipse the setting that mentionned the command to build the project using this command (see scrennshot, I removed it for the moment).


  • i am thinking to install a linux :-) on my virtual box, it seem easier to make the build :-)
    Maybe we can create a shareable image?

    Another option might be to create a CMake project and generate either makefiles or eclipse projects from that, but that sounds like work (and I've never tried it for cross-compiled projects).
  • Would be execellent if the Linux guys as created an image :-) like this I just have to work it :-)

  • Meanwhile, I continue on my MACOS installation :-)

    I reinstalled everything :-) and followed what mentionned in this thread: http://forum.sonic-potions.com/discussion/306/building-firmware-on-osx#Item_18

    I did the instruction to check my PATH and noticed that my AVR Tool chain path was pointing to the wrong lib (I changed the name whilme installing the CrossPACK AVR, I am stupid!!!!):

    vi .bash_profile -> edit your path accordingly :-)
    source ./.bash_profile
    music$ echo $PATH
    /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/CrossPack-AVR/bin:/usr/local/CrossPack-AVR-20131216/bin:/usr/local/CrossPack-AVR-20131216/

    I got now the following message in the console (no more errors):

    **** Build of configuration Release for project DrumSynth_FPU ****

    Nothing to build for project DrumSynth_FPU

    ///

    Any idea?


  • Eclipse is weird, you need to mess around with build clean, and rebuild indexes (or some other magical combo) before it creates the eclipse make files. I never could figure out exactly what fixed this. Seems to happen only if you haven't built yet.
  • little by little , i guess that i progress ... hum, things seems to compile but i get the following error now (i had 550 errors, i have only 3 by now) :

    make all
    Building file: ../src/Sequencer/EuklidGenerator.c
    Invoking: Cross ARM C Compiler
    arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -O2  -g -I/usr/include -std=gnu11 -MMD -MP -MF"src/Sequencer/EuklidGenerator.d" -MT"src/Sequencer/EuklidGenerator.o" -c -o "src/Sequencer/EuklidGenerator.o" "../src/Sequencer/EuklidGenerator.c"
    In file included from ../src/Sequencer/EuklidGenerator.c:38:0:
    ../src/Sequencer/EuklidGenerator.h:40:23: fatal error: stm32f4xx.h: No such file or directory
     #include "stm32f4xx.h"
                           ^
    compilation terminated.
    make: *** [src/Sequencer/EuklidGenerator.o] Error 1

    ***** any hint ?

    cheers :-)
  • Looks like the include path for Libraries/Device/STM32F4xx/include isn't set correctly. On second thought, it seems no additional include paths are given to the compiler (-Ipath), but I can't say where to look for those in eclipse...

    And shouldn't that be -mcpu=cortex-m4?

  • oki, i will look further.

    -mcpu=cortex-m4 -> you may be right ! i will cha,ge it in the toolchain settings :-)

    thx!
  • changing to cortex-m4 and rebuild brings me new errors (inlude not find for AVR code) that may comes due to strange headers in the code:

    #include "../config.h"
    #include "PresetManager.h"
    #include "../Hardware\SD/ff.h"
    #include <stdio.h>
    #include "../Menu/CcNr2Text.h"
    #include "..\Menu\menu.h"

    the '/' and '\" are not good on unix / linux

    i am a bit lost:
    - shall i compile using cortex-m3 or m4
    - is the backslash issue related to another thread ion this forum (discussion between tb323 and rudog) ?

    regards :-)
  • edited April 2014
    I confirm: i should compile using cortex-m4 :-)
  • I'd just expect all the \ should be changed to /  Looks like stuff that is left over from windows.  You never know, it might be that the compiler is smart enough to figure that out, and it isn't the cause of your errors.  Or...that could be the 3 you have - It can't find 3 header files!

    Of course, with C compilers you can fix one of 3 errors, then get 100 more!
  • There are probably more settings you'll need to change then, e.g. -mfloat-abi=hard or -mfpu...

    Ok, so I installed Eclipse and now I see why it doesn't work out-of-the-box (the .cproject references Windows toolchains/local paths directly). I haven't read all the older threads yet, but I expect the Linux folks had the same issue?
    Has someone already written Makefiles instead? If not, I can probably whip some up tomorrow when I'm not at work...
  • edited April 2014
    good idea to change the .cproject.
    I am not a specialist of eclipse, can you tell me how can I see in eclipse the .cproject?
    cheers.
  • I found a way to open the CPROJECT.. on my side, I did change the references to C:/ and I changed some of the headers containing path with '/'.

    I think now I should complete the gcc-arm command line with option '-MCU=ATMEGA644" etc..
    anyone knows what should be put in the the command line of the ARM GC compiler?

    Cheers!
  • good idea to change the .cproject.
    I am not a specialist of eclipse, can you tell me how can I see in eclipse the .cproject?
    cheers.
    I opened it with emacs ;) I'm not sure how much you will be able to manually fix in that, since it references Windows-specific Eclipse-cross-compilely-class-stuff...
  • @pld if you come up with Makefiles, I'd be happy to push them in my fork.

    Here is the command line I end up executing for that one file in the arm project (I'm on Windows, remember):

    arm-none-eabi-gcc -DHSE_VALUE=8000000 -DSTM32F4XX -DUSE_DEVICE_MODE -DUSE_USB_OTG_FS -DUSE_STDPERIPH_DRIVER -DUSE_STM32F4_DISCOVERY -DNDEBUG "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\Libraries\\CMSIS\\Include" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\Libraries\\Device\\STM32F4xx\\Include" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\Libraries\\STM32F4xx_StdPeriph_Driver\\inc" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\Libraries\\STM32_USB_Device_Library\\Core\\inc" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\Libraries\\STM32_USB_OTG_Driver\\inc" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\src" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\src\\AudioCodecManager" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\src\\DSPAudio" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\src\\Hardware" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\src\\Hardware\\SD_FAT" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\src\\Hardware\\USB" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\src\\MIDI" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\src\\Sequencer" -O3 -ffunction-sections -fdata-sections -ffast-math -freciprocal-math -fsingle-precision-constant -Wall -Wextra -Wa,-adhlns=$@.lst -c -fmessage-length=0 -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -o "src\\Sequencer\\EuklidGenerator.o" "..\\src\\Sequencer\\EuklidGenerator.c"
  • Thanks for that, I was just wondering where I'd have to dig up the #defines and settings :)

  • np. Note that all those include directories are listed under "Include paths" under C/C++ Build - Settings - Tool Settings - Arm Windows GCC C Compiler - Directories. All the -D options are in the same place but under Preprocessor. All the -f options and the rest are controlled through dialog settings.

    The toolchain I'm using for ARM is ARM Windows GCC (Tools for Embedded).

    I think the difficulty arises because different people are using different toolchains. I'm not sure that this eclipse toolchain is even on the mac.

  • There's an equivalent toolchain for mac, but Eclipse apparently hard-codes the toolchain into the .cproject (org.eclipse.cdt.cross.arm.gnu.windows.elf.release.607043204) which causes pain when you open it elsewhere... :|
  • @pld thanks for the hint about the cproject in eclipse, I am going to look at this :-)
  • Issue solved, coming soon with a tuto :-)
Sign In or Register to comment.