I had the inclination tonight to try to compile the HAL firmware branch as an exe using gcc. I’ve run into a bit of trouble but instead of inquiring internally I thought I’d ask on the forums so that others might benefit from my inquiry.
First Issue:
src/spark_protocol.cpp:615:69: error: 'strnlen' was not declared in this scope
Suggestions? I actually ran into some other issues but I have been unable to replicate them.
[Edit] Adding #include <cstring> to the top of that file does not fix the issue.
[Edit] Adding #include <string.h> to the top of that file does not fix the issue.
[Edit] Apparently my compiler (MingGW) doesn’t define strnlen in string.h. ARG
C:\Users\Harrison\AppData\Local\Temp\ccfOEBDs.s: Assembler messages:
C:\Users\Harrison\AppData\Local\Temp\ccfOEBDs.s:22: Error: invalid instruction suffix for `ds'
C:\Users\Harrison\AppData\Local\Temp\ccfOEBDs.s:41: Error: invalid instruction suffix for `ds'
C:\Users\Harrison\AppData\Local\Temp\ccfOEBDs.s:553: Error: no such instruction: `rbit %eax,%eax'
C:\Users\Harrison\AppData\Local\Temp\ccfOEBDs.s:586: Error: no such instruction: `rbit %eax,%eax'
make.exe[1]: *** [../build/target/hal/platform-0/./src/core-v1/core_hal.o] Error 1
make.exe": *** [hal] Error 2
Which might stem from the fact that, in order to “fix” issue 1 I simply define the prototype strnlen in string.h which probably has no corresponding function in the compiled string include but I’m not sure and will try to address that
[Edit] Nope, it apparently is not related to strnlen. Not sure where to go from here
Annnd one more. This one is definitely setup related and not HAL branch related but I’ve run into the issue why trying to compile so I thought I’d add it:
arm-none-eabi-g++.exe: fatal error: e:/spark/sparkcoreprograms/gnu tools arm embedded/4.8 2014q3/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/nano.specs: attempt to rename spec 'link' to already defined spec 'nano_link'
@harrisonhjones, I had issues until I upgraded my gcc to 4.9 ( on Windows 7x64). I’ll test again just to be sure. My problem lies with the part of the make file for the bootloader and I just have not had the time to look into it.
UPDATE: Just tested with gcc 4_9-2014q4-20141203 and it compiled without errors.
I am hoping to do both and I’m compiling the publicly available branch so others can follow along at home. I didn’t have time this weekend to work on it but I’ll try to get to it this week
Did you get the gcc branch compiling? I was trying it this afternoon, was thinking of finally setting up my virtualization environment, and was running into a few of the same errors.
The gcc build was just a hack for a demo to show off the HAL. I did get a virtual core working but cut lots of corners just to make it work for the demo.
The gcc build hasn’t had any love for several months. I fixed some compiler issues yesterday, although there are still a number of missing functions needed for it to link.
The gcc build is going to be a key part of our testing infrastructure, so it should get some needed attention in the coming weeks. Yay!