2024-07-02 11:27 PM
Board Using - STM32H735G-DK
1. I tried moving the whole .bss section into HYPERRAM
/* Uninitialized data section into "RAM_D1" Ram type memory */
. = ALIGN(4);
.bss :
{
/* This is used by the startup in order to initialize the .bss section */
_sbss = .; /* define a global symbol at bss start */
__bss_start__ = _sbss;
*(.bss)
*(.bss*)
*(COMMON)
. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end */
__bss_end__ = _ebss;
} >HYPERRAM /* RAM_D1 */
This causes HardFault Error and the Display is a white screen.
Observation/Guess : maybe because the code that starts the board/MCU is in the bss section and the HYPERRAM is not initialized at the start so the code to initialize the HYPERRAM is inside HYPERRAM. So it is not working.
2. Moving only ucHeap to HYPERRAM
Edited the linkerscript to create a new section
.freertos_data (NOLOAD) :
{
. = ALIGN(4);
_freertos_data_begin = .;
*(.freertos_data)
*(.freertos_data*)
. = ALIGN(4);
_freertos_data_end = .;
} >HYPERRAM
Inside FreeRTOS.h file changed the to 1
#ifndef configAPPLICATION_ALLOCATED_HEAP
#define configAPPLICATION_ALLOCATED_HEAP 1
#endif
in main.c
created an array for ucHeap
/* USER CODE BEGIN PV */
uint8_t ucHeap[ configTOTAL_HEAP_SIZE ] __attribute__ ((section (".freertos_data")));
/* USER CODE END PV */
Now downloaded the program using Debug
Error: Program gets HardFault Error even before going into main() function.
I think because i put a breakpoint in first line of main() function it is not reaching and i cannot 'reset` the debug using the reverse curved arrow.
What error is shown:
heap_4.c having the problem
Observation/Guess : FreeRTOS functions are calling before the init of the External RAM or even before the program is fully start.
Some RWX permission warning also hapening i don't know what that is
If anyone knows this problem please replay.
Thanks.
2024-07-11 03:18 AM
Yes, logically the SystemInit function is where the clocks and memories should be prepared. SystemInit is called before main() and all the C/C++ initializers. But this is not how the ST examples and Cube-generated projects actually are written. Maybe, because all the library code is in C, and it assumes the C initializers already run, and it all goes upside down... You need just to make a decision how/where the stuff should be initialized in your project.