S32G399 Bare Metal DDR initialization Greetings! We are trying to reproduce this core sequence in booting process: but encountered some problems during DDR initialization by M7 core. 1. We created a new project from example in Design Studio; (Linflexd_Uart_Ip_Example_S32G399A_M7: Debug_RAM); 2. Configured and verified DDR, generated source files related to ddr_*.c; 3. copied and adjusted some code related to DDR initialization from GoldVIP example and arm-trusted-firmware; 4. we've got such code sequence in the main.c: Clock_Ip_Init(&Mcu_aClockConfigPB[0]);
IntCtrl_Ip_Init(&IntCtrlConfig_0);
Siul2_Port_Ip_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);
Mpu_M7_Ip_Init(&MPU_M7_ModuleConfig_0);
EnableRdInterconnect(2); // RD2
EnableRdInterconnect(3); // RD3
/* 2. NoC QoS */
FlexNOC_InitNoc(4); // 4 - CORE_ID_M7_0
enable_partition();
ddr_status = ddr_init(); we noticed, that after DDR is initialized it is in sleeping mode, so we wake it up: *(volatile uint32_t*)0x403C0000 = 0x83080023;
*(volatile uint32_t*)0x403C0020 &= ~0x1;
*(volatile uint32_t*)0x403C0030 = 0x0;
*(volatile uint32_t*)0x403C0320 = 0x0;
*(volatile uint32_t*)0x403C0320 = 0x1; The DDR memory starts from address 0x60000000, so during the Debugging with Debug Probe we can see in Assembly that memory is allocated, no errors, no hard fault, but still if we call in GDB: set {uint32_t}0x60000000 = 0xDEADBEEF or x/1xw 0x60000000 it returns "Cannot access memory at address 0x60000000" ddr_status returns 0. Could you please guide us what we are doing wrong? and is that diagram actually applicable as recommended by NXP way to boot S32G399 board? Thank you! Re: S32G399 Bare Metal DDR initialization Hello, @Interrogator
Thanks for your post.
Actually the flow you mentioned is not a typical booting flow while using the S32G platform.
Typical booting flow is as described in AN13750 and GoldVIP, a bootloader is running on the M7_0(also init clock, pin, etc.), which is responsible for loading images for different partition(like M7_1/2, A53_0), while Linux BSP is loaded to A53_0, and DDR would be initialized by the TFA running on the A53_0.
May I know if you are currently working the design? if so, using the booting flow described above is relatively recommended.
BR
Chenyin Re: S32G399 Bare Metal DDR initialization @chenyin_h thank you for your reply! I really appreciate that. Could you also help me with understanding one thing: we currently have the board on hands, and possibly M7 doesn't have bootloader. We flashed Linux Image built by Yocto BSP 46 on the SD card (.sdcard file)), inserted card in the board, switched pins on the board to load from SD card and expected the same behavior as on S32G274, but UART output is completely empty. Although pressing buttons while in the COM session (MobaXterm) making Rx indicator on the board flashing. To see Linux output we need to have M7 bootloader, right? Could you pls suggest the best approach in our situation? Thank you! Re: S32G399 Bare Metal DDR initialization @chenyin_h greetings! 1. We use custom board that only have SW3, SW6.1-2, SW10.1-2 and SW12.1-2 pins. 2. We run bitbake and build an image from the source codes (kernel, bootloaders, rootfs) on our machine. Re: S32G399 Bare Metal DDR initialization Hello, @Interrogator
Thanks for your confirmation
1. Typically, with default BSP code/settings, the images built are targeted booting the S32G3 reference board like RDB3/EVB3.
2. Since you are working with the custom board, it is possible that the images built that could not boot the board correctly, which is actually a custom board bring up issue.
Not sure if you had made any modification on the original BSP46 BSP and any debug logs for locating the issue?
BR
Chenyin Re: S32G399 Bare Metal DDR initialization Hello, @Interrogator
Thanks for your reply.
If you do not need use the M7 side, solely booting the board with BSP is applicable.(M7 bootloader is not mandatory in such setup)
Regarding to the issue you met
1. What kind of board is used? custom one or reference design from NXP?
2. How the BSP46 images that flash to SD card are generated? pre-built images or custom built images are used?
BR
Chenyin
Re: S32G399 Bare Metal DDR initialization Good day, @chenyin_h Thank you for your active participation! 1. We tried out the pre-built BSP 46 for S32G3 RDB3 right now, and unfortunately experienced the same problem. 2. We started Debugging on A core with s32g3xx_attach.py script and found this log in the Debugger Console: 394,149 =cmd-param-changed,param="remote hardware-breakpoint-limit",value="6" 394,149 =cmd-param-changed,param="remote hardware-watchpoint-limit",value="4" 394,150 =cmd-param-changed,param="mem inaccessible-by-default",value="off" 394,151 =cmd-param-changed,param="mem inaccessible-by-default",value="on" 394,164 ~"Core can't be stopped. State: CoreMode.Disabled\r\n" 394,165 ~"Type of the error: [CoreError]\r\n" 394,165 ~"Error code: [200]\r\n" 394,165 ~"\r\n" 394,165 ~"\r\n" 394,165 ~" --- STACK TRACE OF THE INIT SCRIPTS ---\r\n" Does this give you any clues? s32g3xx_attach.py on M core returns the same result. However, s32g3xx_generic_bareboard.py works fine, but our idea was to attach debugger to the core that is already launched and check its status via Registers in Assembly. Re: S32G399 Bare Metal DDR initialization Hello, @Interrogator
Thanks for your reply.
The BSP46 pre-built images should work on RDB3(unless it is very old version board)
1. Would you mind confirming if you have both RDB3 and custom board?(since different board are mentioned in your different replies)
2. The final target is to run the BSP or GoldVIP style design(M bootloader -> A(BSP) + M(App))? based on your custom board or RDB3 is enough?
We could discuss further for the details(If some of the contents are not convenient to share, we may also discuss it in private messages/support case), and to divide the target into several phases to help you to use the S32G efficiently in your system designed.
BR
Chenyin Re: S32G399 Bare Metal DDR initialization Hello, @Interrogator
Thanks for your reply.
Sorry that I feel a little confused about your testing setup, would you mind clarifying it accordingly:
1. From hardware view, may I know if you hold a custom board(the board that designed by your company or 3rd party) or a reference board(designed by NXP, you may bought it from NXP or any certified distributer, the reference board of S32G3 may be called RDB3/EVB3/GoldBox3)?
2. BSP is software released by NXP which is mainly targeted running on A53 side of S32G3, would you please help to confirm if your final target is to run BSP on RDB3? or run BSP on your custom board?
BR
Chenyin Re: S32G399 Bare Metal DDR initialization Hello, @chenyin_h Sorry for the confusing answer in the previous post. Let me clarify it a bit for you: 1. I'm holding a custom board 2. my final target is to run BSP on our custom board Thank you! Re: S32G399 Bare Metal DDR initialization Hello, @Interrogator Thanks for your confirmation.
For such bring up issue, I may need to check your hardware design firstly, in order for conveniently share the information like schematic, I will help you create a private case later, for better further discussion.
BR
Chenyin
Re: S32G399 Bare Metal DDR initialization Greetings, @chenyin_h 1. I have only custom board, I just tried different approaches to launch it (RDB3 and GoldVIP) 2. The final target is to run the RDB3/BSP approach. Thank you for your engagement, I wouldn't mind further help. Which additional information would be helpful for you?
View full article