DRNadler/FreeRTOS_helpers

some errors during compile

Closed this issue · 2 comments

I am really new at all of this, I have the latest STM32CubeIDE with the lateast firmware and middleware package downloaded.

Trying to create a FreeRTOS lwip MQTT client. but having major difficulties.

Anyways, I read through the documentation on how to create this .c file but the instructions are somewhat unclear.

I dont know where to put the #include heap_useNewlib.c? which file? from where?

Also even without the include, when I try to compile I am getting these errors:
`
I../Middlewares/Third_Party/mbedTLS/include/mbedtls -I../Middlewares/Third_Party/mbedTLS/include -I../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/system_stm32f7xx.d" -MT"Core/Src/system_stm32f7xx.o" -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/system_stm32f7xx.o"
../Core/Src/heap_useNewlib.c: In function '_sbrk_r':
../Core/Src/heap_useNewlib.c:64:33: error: 'configISR_STACK_SIZE_WORDS' undeclared (first use in this function); did you mean 'configMINIMAL_STACK_SIZE'?
#define ISR_STACK_LENGTH_BYTES (configISR_STACK_SIZE_WORDS4) // bytes to reserve for ISR (MSP) stack
^
../Core/Src/heap_useNewlib.c:166:82: note: in expansion of macro 'ISR_STACK_LENGTH_BYTES'
TotalHeapSize = heapBytesRemaining = (int)((&__HeapLimit)-(&__HeapBase))-ISR_STACK_LENGTH_BYTES;
^~~~~~~~~~~~~~~~~~~~~~
../Core/Src/heap_useNewlib.c:64:33: note: each undeclared identifier is reported only once for each function it appears in
#define ISR_STACK_LENGTH_BYTES (configISR_STACK_SIZE_WORDS
4) // bytes to reserve for ISR (MSP) stack
^
../Core/Src/heap_useNewlib.c:166:82: note: in expansion of macro 'ISR_STACK_LENGTH_BYTES'
TotalHeapSize = heapBytesRemaining = (int)((&__HeapLimit)-(&__HeapBase))-ISR_STACK_LENGTH_BYTES;
^~~~~~~~~~~~~~~~~~~~~~
make: *** [Core/Src/subdir.mk:41: Core/Src/heap_useNewlib.o] Error 1
make: *** Waiting for unfinished jobs....
"make -j6 all" terminated with exit code 2. Build might be incomplete.

16:12:37 Build Failed. 3 errors, 0 warnings. (took 33s.541ms)
`

its like the c file is missing a declaration header file or something.

thoughts?

Xasin commented

Hi!

When including the heap_useNewlib.c file, you should follow the appropriate documentation for the STM32CubeIDE
You can find it here:
http://www.nadler.com/embedded/newlibAndFreeRTOS.html

As you can see by the ending of the file, it is, in fact, a source file, not a header file, and must not be included via the #include statement.
Instead, you should add it to an appropriate source folder so it will be compiled alongside the rest of the code - it should then be appropriately used by the newlib malloc function, and you can simply call malloc or new.

The lack of ISR Stack Size configuration is a bit odd, and I didn't have to configure anything like this for me...
If you are using the STM32Cube IDE, check to see if you can configure this value somewhere - although frankly, this feels like something that should have been addressed in the linker script... Weird.

Like I said, this is all new to me, still learning. I removed the include.

All I am trying to do is get a FreeRTOS enabled lwip MQTT client to work. and having major probs. keep getting error -4 on the mqtt_connect statement so I thought maybe it was FreeRTOS doing it, idk.