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.
Hello,
we noticed a strange behaviour when havin an image loaded from flash by the bootloader and get it executed.
We are not sure where the problem is loacted since it is really hard to debug.
So we created an elf-file and of that an rprc/tiimage. Additionally we have an Bootloader which loads those images placed inside our OPSI-Flash (it runs and starts correctly and loads the images). It does load the image correctly but when we connect to the application it stays inside an abort (sometimes data, sometimes undefined), when loaded with the symbols via CCS (definetly the application-symbols of the exact image inside the flash, which is loaded.)
When we load the same elf-file (so the same used for rprc/tiimage) to the SoC via CCS this problem does never occur.
It was hard to setup the debug-session and to get the debug running correctly but with some hw-breakpoints we could do it:
So the bootloader uses ONLY the first 0x00080000 bytes inside the internal SRAM. It does not use vectors at 0x00000000, which are of course used by our loaded application (that's where we placed the hw-breakpoint to get our application loaded and stopped before starting to run to debug and to get our symbols loaded correctly to see what happens).
Also our application does not use the first 0x00080000 bytes of the SRAM with any initializing stuff (marked with NOLOAD) in Linker-script.
The abort does happen somewhere inside __TI_auto_init_nobinit but we could not really locate why it occurs. It seems to be somewhere in the C++-initialization.
We are excessivly using the linker-script where we locate some sections at different memory-locations, e.g. something like this:
GROUP { .textStack: { -l "libz.lib"(.text), -l "liby.lib"(.text), -l "libx.lib"(.text), --library="libc++.a"(.text), --library="libc++abi.a"(.text), -l "libballuff-platform-mcu1_0.a"(.text) } palign(8) .rodataStack: { -l "libz.lib"(.rodata), -l "liby.lib"(.rodata), -l "libx.lib"(.rodata), --library="libc++abi.a"(.rodata), } palign(8) } > MCU1_0_R5F_MEM_TEXT
we also place some sections inside our external RAM (via GPMC, not DDR!) and we noticed, when the c++-libs are not placed inside the internal SRAM but in the external RAM it is not able to run the application because even when loaded via CCS it directly gets an data-abort, when initializing the c++-stuff. So this was needed.
We may fiddle around with the linker-script right now but we have no clue what really produces this issue. In general we could load an application which has not that much linker-modifications and is kept simple (so just with general.text-sectionplacing and so on, eben with external RAM) from the flash by the bootloader. So it must have something to do with the linking-procedure or at least with the creation of the rprc-image and how the bootloader (or sysfw, I'm not sure her) loads the application into RAM.
It could happen (because that really sometimes happen), when I now change the locations of the sections, the problem is resolved temporarily, but it's not the first time we investigated this problem.
Best regards
Felix
Hi Felix,
The first thing I would look into is the the MPU settings, when you see the data abortion.
It will be in the example.syscfg.
Best regards,
Ming
Hey ming,
we use our own SysCfg and the MPU-settings are not the problem I guess, since - as said - if we load the image via CCS it works fine. Any MPU-problems we had before have shown there already, which is not the case currently.
The problem does occur somewhere in __cxa_atexit, it jumps to a nop-operation and then throws the abort.
Is it possible to set up a meeting since this is blocking us currently.
Best regards
Felix
I currently noticed that the addresses used by the "before main"-code, so the init-code, are different based upon whether you load the elf via CCS or load the image as rprc-image from flash. Seems the rprc-image is somehow wrong here?
In fact the call to __TI_auto_init_nobinit() jumps to a wrong address and after that random stuff happens which leads to an abort. Not only does it jump to the wrong address but even the code loaded into the memory is wrong somehow.
I f I load the image with CCS everything works as expected.
ok Ming, I think we found the problem. It was located at our side:
We used a small place in Flash to store some boot-params. Since the flash-drivers of the sdk do not support a sector-erase we needed to allocate a buffer with 128 KB, which is the block-size (to not overwrite or delete stuff from flash, when doing a block-erase). We allocated that buffer at a region which is also used to load code to. So our bootloader did modify the information in flash and for that copied the whole flash-block into that buffer which in fact overwrote the code which were copied in before by the Bootloader.
This lead to the problem. We will fix this now and if it works I will close this one.
Hi Felix,
Thanks for your information. Glad the issue has been resolved.
Best regards,
Ming