This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Execute functions from special memmory region

I'm trying to compile "Bootloader" with commonly used code. But some of the functions not used in "Bootloader" execution runtime. But they will be used and not modified during "main application" development. In "Main application" this functions will be called with function pointers. void(*MyFunc)(UART_HandleTypeDef *); int main(void) { MyFunc = ((void(*)(UART_HandleTypeDef *))0x0800801d); . . . (*MyFunc)(&huart1); } . I try to create a separate memory region and place functions in this region by putting "#pragma arm section code="func" " into source code file. But linker wipes all unused functions. Also I found "__attribute__((used)" but this does not work with "#pragma arm section code="func" ". They only work by one. Questions: 1. How to put functions into finale binary image without calling it in main function? 2. How to tag functions for not using in code magic numbers like "0x0800801d" (It can be written like "Region$$Table$$Base", but with my own tag names. So instead of 0x0800801d I can write Region$$Func$$MyFunc for each function " MyFunc = ((void(*)(UART_HandleTypeDef *))Region$$Func$$MyFunc);")?

Note
This message was edited to reduce width.

Note
This message was edited to correct formatting.