2024-09-23 01:51 AM
Hello,
When I builed the project, I had seen the Hal drivers files links in the end file *.HEX.
How can I change the project configuration not to put this links in file because it use flash memory unnecessarily ?
Thanks
Solved! Go to Solution.
2024-09-23 08:49 AM
You can get rid of it by not defining USE_FULL_ASSERT .
Or you could change your assert_param definition to not use __FILE__ and, thus, not require that the filenames be stored.
2024-09-23 02:01 AM - edited 2024-09-23 02:02 AM
What optimisation level are you using?
By default, 'discard unused sections' should be enabled - so unused functions shouldn't appear in the final image.
2024-09-23 02:13 AM
Hi Andrew,
I have -O1 optimisation and your configuration setting.
I give an example of my end Hex file :
0x8005FD0 ........../Drivers/STM32G4xx_Hal_Driver/Src/stm32g4xx_hal_wwdg.c .....
This link in hex file isn't necessarily...
2024-09-23 02:18 AM
@Fredolive wrote:I give an example of my end Hex file :
0x8005FD0 ........../Drivers/STM32G4xx_Hal_Driver/Src/stm32g4xx_hal_wwdg.c .....
You mean your ELF file? The Hex file wouldn't have any symbol information...
2024-09-23 02:20 AM
I have this links in Hex file
2024-09-23 02:26 AM
How do you determine that they are actually in the Hex file?
Again, the Hex file contains no symbol information - it is purely code - so where are you seeing that?
2024-09-23 02:47 AM
This is my hex file for my application.
You look the links file at the end file Hex
2024-09-23 03:04 AM - edited 2024-09-23 03:41 AM
Do you use __FILE__ in your code? Also __LINE__ ?
EDIT:
They would appear if you define USE_FULL_ASSERT:
/* Exported macro ------------------------------------------------------------*/
#ifdef USE_FULL_ASSERT
/**
* @brief The assert_param macro is used for function's parameters check.
* expr If expr is false, it calls assert_failed function
* which reports the name of the source file and the source
* line number of the call that failed.
* If expr is true, it returns no value.
* @retval None
*/
#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
/* Exported functions ------------------------------------------------------- */
void assert_failed(uint8_t* file, uint32_t line);
#else
#define assert_param(expr) ((void)0U)
#endif /* USE_FULL_ASSERT */
EDIT 2:
If you do want the ASSERT output, but still want to save a little Flash space, you could use __FILE_NAME__
https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html#:~:text=__FILE_NAME__,myheader.h%22.
2024-09-23 06:26 AM
I tried with adn without __FILE__NAME but I have always roots files in flash space.
2024-09-23 06:34 AM
Then you must have other uses of __FILE_NAME__ elsewhere in your code.
Do a grep through your entire codebase.