Other Parts Discussed in Thread: MSP432E401Y, , EK-TM4C129EXL
Hi all,
First of all let me allow to thanks for all that the hard work what you are doing for us under the PANDEMIC.
I am opening this thread because of the following reason. We are developing SW for TM4C129ENCPDT and for MSP432E401Y, and we run into some problems.
I would like to create a custom bootloader for a EK-TM4C129EXL.
In a development stage i took the boot_emac_flash example from the TivaWare_C_Series-2.2.0.295.
I modified the bl_config.h. Uncommented the #define BL_INIT_FN_HOOK and the #define BL_CHECK_UPDATE_FN_HOOK.
I wrote my own functions.
First i just wanted to make sure these functions are running so used a simple blink function.
void MyInitFunc(void){ volatile uint32_t ui32Loop; // // Enable the GPIO port that is used for the on-board LED. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION); // // Check if the peripheral access is enabled. // while(!ROM_SysCtlPeripheralReady(SYSCTL_PERIPH_GPION)) { } // // Enable the GPIO pin for the LED (PN0). Set the direction as output, and // enable the GPIO pin for digital function. // ROM_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0); // // Loop forever. // volatile uint16_t xi; for( xi = 0; xi <100; xi++) { // // Turn on the LED. // ROM_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, GPIO_PIN_0); // // Delay for a bit. // for(ui32Loop = 0; ui32Loop < 500000; ui32Loop++) { } // // Turn off the LED. // ROM_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 0x0); // // Delay for a bit. // for(ui32Loop = 0; ui32Loop < 500000; ui32Loop++) { } } }
In the first trials nothing happend. After that i tried to debug it but is a bit tricky and i realized that the bootloader stuck.
I tried some changes (used volatile) and the prev. inserted code can run in debug mode.
But when i try to run the device in standalone mode no blinking, noting happening. The device was fully ereased prev.
More or less i was happy because in debug mode it worked. So made the second step in my tiny project.
Here is what i modified in the bl_config.h:
- #define BL_CHECK_UPDATE_FN_HOOK DetermineBootSeq
- #define BL_INIT_FN_HOOK MyStartFunc
I wrote the custom BL_CHECK_UPDATE_FN_HOOK to check the content of the eeprom at a specified address.
uint32_t DetermineBootSeq(void){ uint32_t ui32EEPROMInit; uint32_t ReadCustomBLFlags[2]; // // Enable the EEPROM module. // SysCtlPeripheralEnable(SYSCTL_PERIPH_EEPROM0); // // Wait for the EEPROM module to be ready. // while (!SysCtlPeripheralReady(SYSCTL_PERIPH_EEPROM0)) { } // // Wait for the EEPROM Initialization to complete // ui32EEPROMInit = EEPROMInit(); // // Check if the EEPROM Initialization returned an error // and inform the application // if (ui32EEPROMInit != EEPROM_INIT_OK) { while (1) { } } // //Get the EEPROMSize + //READ some data FROM THE LAST 2 WORD OF the EEPROM // //uint32_t EepromMaxSize = EEPROMSizeGet(); EEPROMRead(ReadCustomBLFlags, BL_CUSTOME_FLAGS_ADDRESS, sizeof(ReadCustomBLFlags)); if (ReadCustomBLFlags[BL_ALWAYS_RUN_ADDRESS] == BL_ALWAYS_RUN) { return (1); } else { if (ReadCustomBLFlags[BL_UPDATE_STATUS_ADDRESS] == BL_UPDATE_END) { // // See if the first location is 0xfffffffff or something that does not // look like a stack pointer, or if the second location is 0xffffffff or // something that does not look like a reset vector. // volatile uint32_t *pui32App; pui32App = (uint32_t*) APP_START_ADDRESS; if ((pui32App[0] == 0xffffffff) || ((pui32App[0] & 0xfff00000) != 0x20000000) || (pui32App[1] == 0xffffffff) || ((pui32App[1] & 0xfff00001) != 0x00000001)) { return (1); } //a valid image exists // and no update is needed. // return(0) return (0); } else { //If the update not complated run the bootloader for update return (1); } } }
Also wrote the BL_INIT_FN_HOOK :
void MyStartFunc(void){ volatile uint32_t ui32Loop; // // Enable the GPIO port that is used for the on-board LED. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION); // // Check if the peripheral access is enabled. // while(!ROM_SysCtlPeripheralReady(SYSCTL_PERIPH_GPION)) { } // // Enable the GPIO pin for the LED (PN0). Set the direction as output, and // enable the GPIO pin for digital function. // ROM_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0); // // Loop forever. // volatile uint32_t xi; for( xi = 0; xi <100; xi++) { // // Turn on the LED. // ROM_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, GPIO_PIN_0); // // Delay for a bit. // for(ui32Loop = 0; ui32Loop < 500000; ui32Loop++) { } // // Turn off the LED. // ROM_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 0x0); // // Delay for a bit. // for(ui32Loop = 0; ui32Loop < 500000; ui32Loop++) { } } }
Right now it is working only in debug mode, but if i change something in the code it is freezing and nothing happening.
Where should i start to examine?
So, 2 question lefts for me.
Why it is only working in debuge mode?
- Should i modify something in the bl_link_css.cmd?
Why is that this code can run in debuge mode but if i change something it stuck
I read the SW-TM4C-BOOTLDR-UG-2.2.0.295.
Any helping hand is welcome.
Im using CCS Version: 10.2.0.00009, TivaWare_C_Series-2.2.0.295.
I really appreciate that if we can start conversion with these problems and would be a great if you can suggest better ideas.
Stay safe and keep calm.