2025-05-16 8:34 AM
I am using the STM32N6570-DK board to drive some sensors and show the data on the LCD. But I encountered some problems. I follow the steps below:
1. open the STM32CUBEMX and choose the STM32N6 MCU, and select the secure domain only option.
2. configurate the clock and set the CPU frequency at 600MHz,and set the PLL1 at 1200MHz, using the HSE.
3. generate code, and import some BSP programs into the application part, the FSBL only import some basic HAL files, and I didn't add any lines into it.
4. click into the stm32n6570_discovery_lcd.c, and add lines as follows:
add these into the BSP_LCD_Init():
RIMC_MasterConfig_t RIMC_master = {0};
RIMC_master.MasterCID = RIF_CID_1;
RIMC_master.SecPriv = RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_PRIV;
HAL_RIF_RIMC_ConfigMasterAttributes(RIF_MASTER_INDEX_LTDC1 , &RIMC_master);
HAL_RIF_RIMC_ConfigMasterAttributes(RIF_MASTER_INDEX_LTDC2 , &RIMC_master);
HAL_RIF_RIMC_ConfigMasterAttributes(RIF_MASTER_INDEX_DMA2D, &RIMC_master);
HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_LTDCL1 , RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_PRIV);
HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_LTDCL2 , RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_PRIV);
HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_DMA2D , RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_PRIV);
HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_LTDC , RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_PRIV);
change the clock config so that the LTDC frequency is 25MHz:
RCC_PeriphCLKInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
RCC_PeriphCLKInitStruct.LtdcClockSelection = RCC_LTDCCLKSOURCE_IC16;
RCC_PeriphCLKInitStruct.ICSelection[RCC_IC16].ClockSelection = RCC_ICCLKSOURCE_PLL1;
RCC_PeriphCLKInitStruct.ICSelection[RCC_IC16].ClockDivider = 48;
5.add these lines into the main.c:
/* USER CODE BEGIN 2 */
BSP_LCD_Init(0, LCD_ORIENTATION_LANDSCAPE);
UTIL_LCD_SetFuncDriver(&LCD_Driver);
UTIL_LCD_Clear(UTIL_LCD_COLOR_RED);
UTIL_LCD_SetTextColor(UTIL_LCD_COLOR_WHITE);
UTIL_LCD_SetBackColor(UTIL_LCD_COLOR_RED);
UTIL_LCD_SetFont(&Font24);
UTIL_LCD_DisplayStringAt(10,50,(uint8_t *)"HELLO",CENTER_MODE);
/* USER CODE END 2 */
6.click the debug button, and when compiling this application part, it shows a warning:
D:/STM32CubeIDE/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: warning: ZYF_Appli.elf has a LOAD segment with RWX permissions
7.next, when entering the debug mode, it shows another information:
Break at address "0x18003a1a" with no debug information available, or outside of program code.
8.when running into the UTIL_LCD_Clear(UTIL_LCD_COLOR_RED);, the error occurs:
Break at address "0xf800f800" with no debug information available, or outside of program code.
After tracing the error, I discovered that the route is like this:
UTIL_LCD_Clear->UTIL_LCD_FillRect->FuncDriver.FillRect(DrawProp->LcdDevice, Xpos, Ypos, Width, Height, CONVERTARGB88882RGB565(Color));->LL_FillBuffer->HAL_DMA2D_Start
The error occurred when running the HAL_DMA2D_Start line.
Surprisingly, the same lines and programs can run in the FSBL part.
My program is uploaded, and I hope that someone can help to fix it.
2025-05-16 8:49 AM
Hello @Runsen_An
Could you share your project please? then we can assist you more effectively.
2025-05-16 9:19 AM
2025-05-19 12:41 AM
Hello @Runsen_An
You need to ensure that the permissions for each section are correctly set in your linker file.
Here's how you can do it:
Locate the Linker Script: Open this file to review the memory and section definitions.
Adjust Memory Attributes: Look for sections that might have RWX permissions and adjust them. For example, code sections should generally have RX (Read and Execute) permissions, while data sections should have RW (Read and Write) permissions.
SECTIONS
{
.text : { *(.text) } > FLASH
.data : { *(.data) } > RAM
.bss : { *(.bss) } > RAM
}