AnsweredAssumed Answered

STM32CubeMX 4.23.0 syscalls.c bugs ?

Question asked by Heiko Jakob on Oct 28, 2017
Latest reply on May 4, 2018 by Cyril FENARD

Hi,

 

i'm using STM32CubeMX V 4.23.0 to build a project for a stm32f107vct with FatFs, LWIP & FreeRTOS using the gcc-arm-none-eabi-6-2017-q2-update toolchain.

 

Compiling the generated syscalls.c fails due various errors (see output below).

  1. One problem is that "#ifdef _SYS_TIME_H_" should be "#ifndef _SYS_TIME_H_", because timezone is already defined via the generated <sys/time.h> include in gcc-arm-none-eabi-6-2017-q2-update/arm-none-eabi/include/sys/time.h and _SYS_TIME_H_ is therefore already set.

    #ifdef _SYS_TIME_H_
    struct timezone {
    int tz_minuteswest; /* minutes west of Greenwich */
    int tz_dsttime; /* type of dst correction */
    };
    #endif

  2. gcc relies on __asm_() instead asm() when using ANSI-C or STD-C so the following generated statement should be changed

    caddr_t _sbrk(int incr)
    {
    extern char end asm("end"); // should be __asm__("end");
    static char *heap_end;
    char *prev_heap_end,*min_stack_ptr;

 

With best regards

Heiko Jakob

 

arm-none-eabi-gcc -mthumb -mcpu=cortex-m3 -mfloat-abi=soft -ffunction-sections -fdata-sections -Os -flto -fno-exceptions -Wall -DSTM32F107xC -c -g -Iinclude -Ilib/STM32CubeMX/Inc -Ilib/STM32CubeMX/Drivers/CMSIS/Include -Ilib/STM32CubeMX/Drivers/STM32F1xx_HAL_Driver/Inc -Ilib/STM32CubeMX/Drivers/CMSIS/Device/ST/STM32F1xx/Include -Ilib/STM32CubeMX/Middlewares/Third_Party/LwIP/src/include -Ilib/STM32CubeMX/Middlewares/Third_Party/LwIP/system -Ilib/STM32CubeMX/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS -Ilib/STM32CubeMX/Middlewares/Third_Party/FreeRTOS/Source/include -Ilib/STM32CubeMX/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3 -Ilib/STM32CubeMX/Middlewares/Third_Party/FatFs/src -Ilib/STM32CubeMX/Middlewares/ST/STM32_USB_Device_Library/Core/Inc -std=c11 -MMD -MP -MF "build/Debug/GNU_ARM_NONE_EABI_6_2017Q2-Linux/lib/STM32CubeMX/Src/syscalls.o.d" -o build/Debug/GNU_ARM_NONE_EABI_6_2017Q2-Linux/lib/STM32CubeMX/Src/syscalls.o lib/STM32CubeMX/Src/syscalls.c
lib/STM32CubeMX/Src/syscalls.c: In function '_sbrk':
lib/STM32CubeMX/Src/syscalls.c:98:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'asm'
extern char end asm("end");
^~~
lib/STM32CubeMX/Src/syscalls.c:98:18: warning: implicit declaration of function 'asm' [-Wimplicit-function-declaration]
lib/STM32CubeMX/Src/syscalls.c:103:15: error: 'end' undeclared (first use in this function)
heap_end = &end;
^~~
lib/STM32CubeMX/Src/syscalls.c:103:15: note: each undeclared identifier is reported only once for each function it appears in
lib/STM32CubeMX/Src/syscalls.c: At top level:
lib/STM32CubeMX/Src/syscalls.c:129:8: error: redefinition of 'struct timezone'
struct timezone {
^~~~~~~~
In file included from lib/STM32CubeMX/Src/syscalls.c:75:0:
/opt/gcc-arm-none-eabi-6-2017-q2-update/arm-none-eabi/include/sys/time.h:50:8: note: originally defined here
struct timezone {
^~~~~~~~

Attachments

Outcomes