2024-07-01 12:12 PM
When using HAL library, HAL_Init has init code:
#if (INSTRUCTION_CACHE_ENABLE == 0U)
__HAL_FLASH_INSTRUCTION_CACHE_DISABLE();
#endif /* INSTRUCTION_CACHE_ENABLE */
#if (PREFETCH_ENABLE != 0U)
__HAL_FLASH_PREFETCH_BUFFER_ENABLE();
#endif /* PREFETCH_ENABLE */
But when using ONLY LL library, these two settings are ignored. Enabling or disabling the two settings generates the same code. Please fix it.
2024-07-02 02:25 AM
Hi @eos1d3
Which STM32 product are you using? Did you check HAL system configuration in stm32xx_hal_conf.h file. You may check definitions in this file rather than in toolchain compiler preprocessor.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-07-02 04:22 AM
Hi,
I am using STM32G03x. As I said earlier, to test this, please do NOT use any HAL components, just use only Low Level library. So stm32xx_hal_conf.h is not generated and there is no such file in the STM32Cube project.
When you change Prefetch Buffer and Instruction Cache in the above screen. Their values are updated in .project and .mxproject. But there is no initialization codes to use the values. So these settings are always power on default values.
If you use any HAL library, HAL_Init will be generated and there are initialization codes (in my first post) for these settings.
So using pure Low Level library, the Prefetch Buffer and Instruction Cache initialization codes are missing. The missing part is listed below. Code generation should add these code to main() if HAL is not used.
int main(void)
{
/* USER CODE BEGIN 1 */
/* Configure Flash prefetch, Instruction cache */
/* Default configuration at reset is: */
/* - Prefetch disabled */
/* - Instruction cache enabled */
#if (INSTRUCTION_CACHE_ENABLE == 0U)
LL_FLASH_DisableInstCache();
#endif /* INSTRUCTION_CACHE_ENABLE */
#if (PREFETCH_ENABLE != 0U)
LL_FLASH_EnablePrefetch();
#endif /* PREFETCH_ENABLE */
/* USER CODE END 1 */
....
}