Firmware compile error "undefined reference to `main'"

Dear all,

I am having some trouble with compiling some software in platformIO. More particular, this one:

I would like to make some experimental changes to try out. However, I cannot even compile the project.

First you are hit with an unknow MCU error or something like that. That can be fixed with modifying /buildroot/boards/STM32F030C8.json from line 17. This should be the new code if I have done everything correctly.

“ldscript": "buildroot/ldscripts/STM32F030C8_FLASH.ld”,
“mcu": "stm32f030c8t6”,
“product_line": "STM32F030X8”,
“variant": "stm32f0”,

This gets rid of this error. But a new one appears.
Building in release mode
Linking .pioenvs/BIGTREE_S42B_V1_0/firmware.elf
.pioenvs/BIGTREE_S42B_V1_0/libFrameworkCMSISDevice.a(startup_stm32f030x8.o): In function LoopFillZerobss':* *(.text.Reset_Handler+0x32): undefined reference to main’
collect2: error: ld returned 1 exit status
**** [.pioenvs/BIGTREE_S42B_V1_0/firmware.elf] Error 1*

I have been looking al over the internet. My main program is named correctly. Some other suggestion on how to fix this where out of my league. This is beyond my knowledge. Some help would be greatly appreciated :wink:

Somebody already fixed these errors in a PR but the author never bother to merge it. Abandoned project.

In addition to that I had to fix the include path because the files for the STM32Cube HAL (LL driver) were in there double but mismatched by version. Really bad organization.

So just clone https://github.com/maxgerhardt/TrueStep.git and build the project as-is.

Hi MaxGerHardt,

Thanks for your response.

I just cloned your version of the software but still get the same error. Sadly enough.
Linking .pioenvs/BIGTREE_S42B_V1_0/firmware.elf
.pioenvs/BIGTREE_S42B_V1_0/libFrameworkCMSISDevice.a(startup_stm32f030x8.o): In function LoopFillZerobss':* *(.text.Reset_Handler+0x32): undefined reference to main’
collect2: error: ld returned 1 exit status
**** [.pioenvs/BIGTREE_S42B_V1_0/firmware.elf] Error 1*
(.text.Reset_Handler+0x32): undefined reference to `main’

Are you on Linux perhaps with case-sensitive filepaths? They even managed to missspell the source directory so you’ll have to correct in the platformio.ini the value

src_dir      = close_loop

to

src_dir      = Close_loop

Indeed linux.
:slight_smile: Thanks so much! That one helped!

Still got errors though. But I think I should be able to solve this one on my own.

Close_loop/src/Hardware/display.c:1:10: fatal error: main.h: No such file or directory

The build_flags’s -I flags have more upper/lowercase errors. Let me correct them.

I should have seen that one myself…
Already got it working. Indeed more upper/lowercase errors.

This is great! Now I can modify the firmware to my hearts content. Thank you so much!

1 Like

I’ve fixed all build issues in Commits · maxgerhardt/TrueStep · GitHub now.

1 Like