AnsweredAssumed Answered

Cube32 generates __RAMFUNC error

Question asked by Harvey White on Mar 30, 2018

I have compile problems with TrueStudio.  The code generated by Cube 32 gives an error (needs "," etc) before the Flash memory routines.  I'm not using them that I know of, so it may be a setting I am not familiar with.  However, without fixing those errors, the code does not compile.


The definition


#define __RAM_FUNC  HAL_StatusTypeDef  __attribute__((section(".RamFunc")))


is located in stm32f4xx_hal_def.h, and is called specifically by :  stm32f4xx_hal_flash_ramfunc.c


for example:

__RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_EnableFlashSleepMode(void)


The appropriate references in stm32f4xx_hal_flash_ramfunc.c refer to properly to stm32f4xx_hal_def.h.



However, the difficulty is in the definition of RAMFUNC, which has an extra HAL_StatusTypeDef in the macro expansion. 


The macro thus expands to:

HAL_StatusTypeDef  __attribute__((section(".RamFunc"))) HAL_StatusTypeDef HAL_FLASHEx_EnableFlashSleepMode(void)


causing errors.  Changing the 4 functions affected to:


__attribute__((section(".RamFunc"))) HAL_StatusTypeDef HAL_FLASHEx_EnableFlashSleepMode(void)


allows the program to compile.

Removing this allows the program to compile.  However, any changes made to Cube 32 regenerates the bad code. 

This may have come in with a particular update, or it may be an assumption made in TrueStudio.


Anyone run into this?