I wrote code for a bootloader which works fine under debugger ( old JLink ) but not at repowering the 1024 eval board.
Code reallocates FlexRAM to 128K ITC and 64K OCRAM then copies itself into RAM then SystemInit is called before jumping to main(). Early in main ( before tasks ) I set the user LED. For this testing the LED is in an infinite loop.
Specific procedure is to download code under debug, either stop debugger or not, repower, and get no LED. Same issue if I download via GUI Flash tool - no LED at repower. RT1024 eval board DIP switches for internal - { 1234} = { 0010}
How does debug operation differ from booting from flash?
Very new to this so could be something obvious. ResetISR and main() below.
========================
SectionTableAddr = &__data_section_table;
// Copy the data sections from flash to SRAM.
while (SectionTableAddr < &__data_section_table_end) {
LoadAddr = *SectionTableAddr++;
ExeAddr = *SectionTableAddr++;
SectionLen = *SectionTableAddr++;
data_init(LoadAddr, ExeAddr, SectionLen);
}
// At this point, SectionTableAddr = &__bss_section_table;
// Zero fill the bss segment
while (SectionTableAddr < &__bss_section_table_end) {
ExeAddr = *SectionTableAddr++;
SectionLen = *SectionTableAddr++;
bss_init(ExeAddr, SectionLen);
}
SystemInit();
uint32_t x=0;
while ( x<10000000 )
{
x++;
}
#if defined (__REDLIB__)
// Call the Redlib library, which in turn calls main()
__main();
#else
main();
#endif
======================
BOARD_ConfigMPU();
BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitDebugConsole();
USB_HostApplicationInit();
GPIO_PinWrite(EXAMPLE_LED_GPIO, EXAMPLE_LED_GPIO_PIN, 1U);
//GPIO_PinWrite(EXAMPLE_LED_GPIO, EXAMPLE_LED_GPIO_PIN, 0);
usb_echo("looping LED...\r\n");
while(1)
{
GPIO_PinWrite(EXAMPLE_LED_GPIO, EXAMPLE_LED_GPIO_PIN, 1);
}
Hi @GoatRope ,
Thanks so much for your shared project and the information.
As you are our key customers, to our working flow, we have the FAE to follow you directly, so, my boss already switch your case to our FAE side directly.
Do you get NXP FAE contact information to you directly by email or not?
If still no information, please kindly let me know, thanks.
Best Regards,
Kerry
Hi @GoatRope ,
You can share your issues project here, then we can find time to help you to check it.
You can delete all the important code to you, just leave the code that can reproduce the issues.
From your description, your bootloader is just the app which do the flexRAM reallocation, and debugging also confirms the working, just boot have issues, you can share the project for analysis, thanks.
Best Regards,
kerry
Yes Kerry - under debugger I reallocate RAM, copy code ther, jump to main, various Init functions, turn on user LED. Without debugger no LED. Attached is a simplified project.
I'll look thru to see if I can tell you any unusual stuff I did, please keep in mind I am new to this so I could have something obvious. One thing to note is I use a custom linker file at build/msd_djb.ld. Also I reduced Flash size for this bootloader so I do not erase any previously loaded application code at every debug session. See in common.h:
#define APP_LOCATION_BASE ( ( SECTOR_0_LOCATION + BOOTLOADER_RESERVED ))
#define APP_LOCATION_VECTORS ( ( SECTOR_0_LOCATION + BOOTLOADER_RESERVED + APP_TEXT_OFFSET ))
Hi
When you load the boot loader using the debugger where do you store it (usually in internal QSPI flash)?
To be able to boot the code needs a header (which is recognised by the internal ROM loader and configures the FlexSPI) - do you have this in the image? [debuggers may be using a config file that configures some things on connect].
See also https://www.utasker.com/iMX/RT1024.html for ready made boot loader for the 1024 (various interfaces like USB, UART, SD card, memory stick, Ethernet, etc., dynamic FlexRAM reconfiguration, encryption, operation in XiP, ITC or SDRAM and clone protection).
Regards
Mark
For i.MX and Kinetis stock availability see https://www.utasker.com/Shop/semi.html
Thanks, Mark. I do have ivt, bd, dcd in the image per map, along with XIP_BOOT_HEADER_ENABLE and I added XIP_BOOT_HEADER_DCD_ENABLE. I'm assuming these are what you refer to. Yes stored at 0x60000000 and 0x60002000 like usual.
Utasker may be an option - things are in flux.
Hi
Yes, that sounds basically correct like that.
The uTasker loader can be used with any application code and could be a solution for you since it is proven (used in various industrial i.MX RT products for a number of years), documented and supported as well as being very flexible and can be build for any i.MX RT10xx part (incl. 1024) in a few minutes (GCC make file, MCUXpresso, IAR, Keil or Rowley Crossworks).
There are some documents and videos that may help to get a full picture of what it offers as a turn-key solution:
https://www.utasker.com/docs/iMX/Loader.pdf
https://www.utasker.com/docs/uTasker/uTaskerSerialLoader.pdf
https://www.utasker.com/docs/iMX/MCUXpresso.pdf
https://www.youtube.com/watch?v=5iT7KP691ls&list=PLWKlVb_MqDQEOCnsNOJO8gd3jDCwiyKKe&index=11
https://www.youtube.com/watch?v=fnfLQ-nbscI&list=PLWKlVb_MqDQEOCnsNOJO8gd3jDCwiyKKe&index=12
Regards
Mark