Part Number: MSP432P4111
Hi ,
We are trying to support two image on msp4324111 evm board. The msp432 will have a default bin loaded already . Now the second image has to be loaded to the location
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.
Part Number: MSP432P4111
Hi ,
We are trying to support two image on msp4324111 evm board. The msp432 will have a default bin loaded already . Now the second image has to be loaded to the location
Hi Eason,
Thanks for the information , but for our project we are not using css. We are using gcc for creating bin files. The lds file i am referring to is msp432p4111.lds file which has the memory sections defined it in simplelink library. I want to be able to load two image files onto MSP432 and switch between the two images present on MSP432.
Also I notice on Uniflash we have the option to load multiple image files and we can specify the load address , but on loading two images onto MSP432 how do i switch between the two images. It would be helpful on what i should do to switch between the two images.
Thanks
Neetha
Hi Neetha,
I think the problem does not lie on how to download two application code into MSP432. It lies on how to switch between these two images.
From my experience, there is two choice:
1. The memory only saves two application code. For MSP432, after it reset, it first jump to 0x00000004, the it jump to Reset_Handler(). In Reset_Handler(), it jump to _c_int00_noinit_noargs(). In _c_int00_noinit_noargs(), it jump to main functions. You can just save the entrance address of Reset_Handler() of two images at a certain place. The in the application code change the address save at 0x00000004. Then reset the device.
2. Use another code to arrange these two application code. The problem is that you need to handle the interrupt vector which is saved at the same place, but is different for two different application. You also need to handle this part in the extrnal code. It is not a easy job.
Can you tell me why you want to keep two application code in one MSP432.
Eason
Hi Eason,
I agree with you, its a complicated task I have been struggling with this task for past few days, thanks for helping me out.
Referring to the first point I understood the flow. You have said we have to save entrance address of the reset_handler for two images at a specific location in memory, i have referred to this link https://e2e.ti.com/support/microcontrollers/msp430/f/166/t/535669 where the interrupt vector address is different , what confused me was both the application code have the same address space for the code/sram regions only the interrupt vector table was at a different location in memory, is that correct?, as per my understanding we need to have different memory regions for two images and write them to the respective locations. If yes then i can have two linker scripts generate two different targets and load them into memory via UART.
The reason for having two application code is we want to be able to remotely update the bin files on MSP432 via UART(Note a default bin will be already present starting from 0x00 location) and if something goes wrong with the updated version, then switch back to the original bin file.
I am sharing the flash program code which I have written, where i am reading from UART and writing to the specified memory space. The user invokes the attached code section by typing code word "reprogram" via UART.
#define START_ADDRESS 0x00100000 #define BUFFER_SIZE 4096 //code writing into flash void writeData() { /* Statics */ char simulatedCalibrationData[BUFFER_SIZE]; FlashCtl_A_setWaitState(0x00, 6); FlashCtl_A_setWaitState(0x01, 6); /* Initializing our buffer to a received data*/ memcpy( simulatedCalibrationData , buffer, BUFFER_SIZE); //![FlashCtl_A Program] /* Unprotecting 0x1FE000 */ MAP_FlashCtl_A_unprotectMemory(currentAddress, currentAddress); /* Trying to erase the sector. Within this function, the API will automatically try to erase the maximum number of tries. If it fails, trap in an infinite loop */ if(!MAP_FlashCtl_A_eraseSector(currentAddress)) { while(1); } /* Trying to program the memory. Within this function, the API will automatically try to program the maximum number of tries. If it fails, trap inside an infinite loop */ if(!MAP_FlashCtl_A_programMemory(simulatedCalibrationData, (void*) currentAddress, BUFFER_SIZE)) { while(1); } /* Setting the sector back to protected */ MAP_FlashCtl_A_protectMemory(currentAddress, currentAddress); //![FlashCtl_A Program] } //UART section where data received void receiveData() { uint32_t i = 0; unsigned char c; while(!_doneRead) { if(i < BUFFER_SIZE && read(c)) { buffer[i] = c; i++; if(c == '@' && read(c)) { if(c == '*') { _doneRead = true; _doneWrite = true; vTaskDelete(currentThreadID()); } buffer[i] = c; i++; } } else { writeData(); currentAddress = currentAddress + BUFFER_SIZE; i = 0; // reset i count } vTaskDelay(1); } jumpToAppStartup(); } // void jumpToAppStartup (void) { SCB->VTOR = 0x100000; //new code assembler __asm__ __volatile__ ("mov r0, #0x100000\n" "ldr r1, [r0, #0]\n" "mov sp, r1\n" "ldr r1, [r0, #4]\n" "mov pc, r1" ); }
Thanks,
Neetha.
Hi Neetha,
The two images are not at a same location in memory. He save the code into FLASH and FLASH_BOOT
First: .intvecs: > 0x00000000 .text : > FLASH_BOOT .const : > FLASH_BOOT .cinit : > FLASH_BOOT .pinit : > FLASH_BOOT Second: .intvecs: > 0x00008000 .text : > FLASH .const : > FLASH .cinit : > FLASH .pinit : > FLASH
From my view, he realize the bootloader same as MSP430. In the default vector table, it jumps to second vector table than it jumps to the _ISR function. The reason is that flash can only erase by segment. You need to save the first code entrance to 0x00000000. So, if you want to overwrite it with the second code, you will overwrite the code entrance. For ARM device, it will jump to 0x00000000 after it power on. What I said yesterday is observed by debugging.
It seems like you will have 3 code in MSP432 at the same time. One code for updating, two code for application. Remember if you want to do like that, you can't use interrupt handler in the updating code!
Another choice is that you have only one code, you just update the functions in this code. So you just download code of functions and put it into the old one. It will save your memory, but it will be more complicated. It will be another method, which is done by some customer.
Eason
**Attention** This is a public forum