This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
Hi
I'm using CCS theia version 1.5.1.3.
Using the AM263P launchpad, I'm trying to get a simple application running in XIP but I can't seem to be able to.
I followed the threads about this:
My SysCfg setup is therefore looking like this:
MPU setup :
In the memory regions, I have the flash set up like this:
Then in sections I have:
Adding all the sections below .rodata.cfg in OCRAM allowed the code to execute until main and the while loop introduced at the start.
Otherwise, the code would go into a prefetch abort in _system_pre_init and __TI_auto_init in the startup code from reset to main.
Then I have the rest of the code in FLASH like suggested into the threads above:
When flashing I put the launchpad board in uart boot mode and flash using the uart_uniflash python script called from a command line:
python uart_uniflash.py -p COM11 --cfg=C:/ti/mcu_plus_sdk_am263px_10_00_00_35/tools/boot/sbl_prebuilt/am263px-lp/default_sbl_ospi_Seb.cfg
My config file is looking like:
# First point to sbl_uart_uniflash binary, which function's as a server to flash one or more files
--flash-writer=sbl_prebuilt/am263px-lp/sbl_uart_uniflash.release.tiimage
# Program the OSPI PHY tuning attack vector
--operation=flash-phy-tuning-data
# When sending bootloader make sure to flash at offset 0x0. ROM expects bootloader at offset 0x0
--file=sbl_prebuilt/am263px-lp/sbl_ospi.release.tiimage --operation=flash --flash-offset=0x0
# When sending application image, make sure to flash at offset 0x81000 (default) or to whatever offset your bootloader is configured for
#--file=../../examples/drivers/ipc/ipc_notify_echo/am263px-lp/system_freertos_nortos/ipc_notify_echo_system.release.appimage --operation=flash --flash-offset=0x81000
#--file=C:/AM263P_VxPlatform/DevOnLaunchpad/Bootloader/LedBlinkingApp_am263px-lp_r5fss0-0_nortos_ti-arm-clang/Debug/LedBlinkingApp_am263px-lp_r5fss0-0_nortos_ti-arm-clang.appimage --operation=flash --flash-offset=0x81000
--file=C:/AM263P_VxPlatform/DevOnLaunchpad/Bootloader/LedBlinkingApp_XIP_am263px-lp_r5fss0-0_nortos_ti-arm-clang/Debug/LedBlinkingApp_XIP_am263px-lp_r5fss0-0_nortos_ti-arm-clang.appimage --operation=flash --flash-offset=0x81000
#XIP section
--file=C:/AM263P_VxPlatform/DevOnLaunchpad/Bootloader/LedBlinkingApp_XIP_am263px-lp_r5fss0-0_nortos_ti-arm-clang/Debug/LedBlinkingApp_XIP_am263px-lp_r5fss0-0_nortos_ti-arm-clang.appimage_xip --operation=flash-xip
The flashing works OK, and I can see the following output from SBL:
When debugging the application, I'm getting into the waiting loop at the start of the main function as expected:
When stepping through the code, the execution goes well until a trampoline to execute from flash which causes a prefetch abort again:
I believe I followed all the steps indicated in the developer training for AM263P4.
I must miss something or do something wrong. Given the exception it is looking like the CPU does not have visibility on the external flash memory.
Following on the documentation below, I'm expecting the SBL to set the FLASH memory right to support XIP and especially activate DAC mode:
From the documentation it looks like it is straight foward but it actually is not. Would it be possible to point me into what I'm doing wrong and point me into the right direction ?
Happy to share the project if required.
Thanks
Regards
Seb
Hi Seb,
Apologies for the delay,
I believe the problem might be arising due to OSPI initialization that you are doing in System init.
While doing XIP and if you try to initialize the OSPI or flash it will give a prefetch abort.
Can you remove OSPI and flash from your application (via syscfg) and try again.
Lets say if you want to do the OSPI/flash init, make sure that code is located in RAM instead of flash
Hi Nilabh
Thanks for your reply. Unfortunately, that does not solve the problem. I removed OSPI from the project but end up having the same issue.
For context I added it to find a way to put the OSPI in DAC mode so that it is visible by the CPU.
But following the instruction in the threads about XIP, it does not seem necessary to do this. And when you look at the program flow, the abort when jumping to DPL_Init() function which is happening much earlier than any OSPI init.
One thing does not make sense to me in the example and instructions given on line.
The example project will have a flash region located at 0x60100000. The prebuilt bootloader expect the application to be flashed at offset 0x81000.
But when you look at the disassembly where the abort happens, the instruction is located at 0x60112BE1.
The application has a size in flash of 0x10b18. Being flashed at 0x81000, max address in flash should be 0x91b18 and seen by the CPU 0x60091b18.
If my understanding is correct, there is effectively no instruction @ 0x60112BE1.
However, when I change the flash location to start at 0x60081000 to align with the flashing location, I get SBL fail error message.
I'll dig into this further but would be great to have a detailed example explaining how things are meant to work and how flashing location should align application memory mapping.
Looking forward to reading from you.
Regards
Seb
Further digging my side:
- when aligning the start of the flash region in sysconfig to 0x60081000, as mentioned above, I get the SBL fail message. This is caused by the read in SBL at address 0x81000 not returning the correct header markers.
Application image - Flash region starting at 0x60100000 print is matching the XIP file
==> Switch to the application does not work. End up in prefetch abort
Application flash aligned to flashing script location :
Image is truncated by 72 bytes !!
SBL fails to recognize the header as mentioned at the top
Adding 72 bytes to start position in flash
Adding 256 bytes to flash start location:
The start address for the flasher seems to need to be aligned to 0x1000
Image is not truncated ie print & image file hex view matches
This time the application is stuck here:
Enabling DAC mode seems only to be part the function Bootloader_verifyMulticoreImage () which is not performed. Also this config is set to 0:
Same for PHY enabling in main.c. In gOspiHandle, the config is set to 0
SysConfig |
Generated code |
|
The configuration does not translate into the phyEnable parameter to be activated. |
DAC mode into the flash Args structure is not set -> Value 0 by default
I can't find a way of enabling DAC mode.
we need a clear explanation about :
- SBL and application interactions
- Application image alignment requirements vs SBL (not just alignment with flashing location)
- How when running in XIP the SW retrieves the correct address for the instruction if there is no alignment ?
- How PHY And DAC modes are getting enabled in SBL as SysCfg parameters don’t seem to be reflected into the code
- Also the dac mode enabling seems to be linked to the image requiring authentication but I can’t see any parameter in sysconfig to enable this
- Do we really authentication active to enable XIP
We need your help in understanding the details steps in getting this to work. The documentation is too light about this.
I can't find a way of enabling DAC mode.
To enable DAC mode you can use this API:
- Application image alignment requirements vs SBL (not just alignment with flashing location)
- How when running in XIP the SW retrieves the correct address for the instruction if there is no alignment ?
- How PHY And DAC modes are getting enabled in SBL as SysCfg parameters don’t seem to be reflected into the code
- Also the dac mode enabling seems to be linked to the image requiring authentication but I can’t see any parameter in sysconfig to enable this
- Do we really authentication active to enable XIP
For SBL and application interaction I would recommend you to go through this: Secondary Bootloader flow in AM26x devices
We need the code and RO-Data to be aligned when you are using XIP
PHY mode enablement happens via syscfg and SBL configures the DAC mode for XIP execution, you can refer to SBL OSPI example for reference
Image authentication is applicable to only secure device(HSSE), not for unsecure device
Non Authentication is not required for XIP.
Can you tell me which example are you trying for XIP and the SBL , better if you can share the syscfg file.
Hi Nilabh
Thanks for your answer.
I already went through the bootflow. I can make it work perfectly fine when the code stays in RAM.
So far no success getting this app to run in XIP.
The documentation explain well the bootflow when the code run from RAM but not for XIP nor when the SBL has loaded the application partially in RAM how instruction address are retrieved. Alignment between flashing location and application flash configuration.
How would that behave when you have 2 applications and you need to switching to one another at start up (ie the SBL will load one or the other ...)
Can't see anything related to nor on the academy nor the forums nor on the docs.
Attached 3 projects. One is the bootloader I testing with. Then you have 2 LED blinking project for the AM263P launchpad. One is configured to work form RAM.
The other (*_XIP*) is configured to work in XIP. It would contain the last setting I tried. See posts above.
To flash I'm putting the board into serial boot mode and uses the uniflash_uart.py script, the config file is in the XIP project.
Looking forward to read from you.
Regards
Seb
Hi Sebastian,
The issue was with the Flash address that you have configured, it should be 0x80000000 instead of 60000000.
Adding 256 bytes to flash start location:
Somehow I missed to validate it in the first go.