Problems building stm32-sine  [SOLVED]

Post Reply
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Problems building stm32-sine

Post by Pete9008 »

I'm trying to build the stm32_sine firmware (FOC build). I think the toolchains are installed correctly but when running 'CONTROL=FOC make' I get:

Code: Select all

  CPP     obj/stm32_sine.o
In file included from src/stm32_sine.cpp:21:0:
/usr/lib/gcc/arm-none-eabi/6.3.1/include/stdint.h:9:26: fatal error: stdint.h: No such file or directory
 # include_next <stdint.h>
                          ^
compilation terminated.
Makefile:96: recipe for target 'obj/stm32_sine.o' failed
make: *** [obj/stm32_sine.o] Error 1
Changing the CPP compiler flag from -fno-builtin to -ffreestanding fixes this. Is this the right way to go or is there a better way of doing it?
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: Problems building stm32-sine

Post by Pete9008 »

Is there a particular version of gcc-arm-none-eabi that I need?

I'm now having problems that the nvic.h file isn't where it expects it to be which suggests a change in the directory structure between compiler versions?
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: Problems building stm32-sine

Post by Pete9008 »

Just realised that it is looking for nvic.h in the stm32_sine subproject - libopenCM3/include/libopencm3/stm32/f1 and it's not there. I can't see it on github either so I don't think it is my local copy that is the problem. Has anyone else come across this?

Edit - It has been seen before - looks like a repository issue
EV_Builder wrote: Sun Jul 04, 2021 5:34 pm

Code: Select all

#ifndef LIBOPENCM3_NVIC_H
#error You should not be including this file directly, but <libopencm3/cm3/nvic.h>
#endif

#if defined(STM32F0)
#	include <libopencm3/stm32/f0/nvic.h>
#elif defined(STM32F1)
#	include <libopencm3/stm32/f1/nvic.h>

#elif defined(STM32F2)
#	include <libopencm3/stm32/f2/nvic.h>
#elif defined(STM32F3)
# include <libopencm3/stm32/f1/nvic.h> this include i cant find it..where is it? My IDE complains about it?
Basicly i cant get the code in the GITHUB right now to build...

OK seems like the online github is broken too..in their doxygen codebase i was able to copy the contents of the file and i made myself the nvic.h file.
a prime example of dynamic linking / when you don't want to be tied to other repo's instead of just haveing one coherent code-base managed by yourself.

Next Stop: leafbms.cpp... 21 errors..
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: Problems building stm32-sine

Post by Pete9008 »

Not getting anywhere with this, found a copy of the file here http://libopencm3.org/docs/latest/stm32 ... ource.html but it appears to be for a different version of libopencm3 as a load of other errors about missing NVIC IRQ defines then appear.

Does anyone have a copy of the correct nvic.h that they could let me have?

Edit - Please ignore, I copied the wrong file, the correct link for the source is http://libopencm3.org/docs/latest/stm32 ... ource.html which compiles OK
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: Problems building stm32-sine  [SOLVED]

Post by Pete9008 »

Still getting the stdint.h problems when compiling libopenCM3 so reviewed this.

If libnewlib-arm-none-eabi is installed then all the problems with stdint.h go away and the everything builds fine with -fno-builtin.

All now compiles OK. Now just need to figure out debugging!
Post Reply