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: Code Composer Studio
Hi,
For avoiding mass erase during BSL flashing on giving wrong password, I am planning to disable this feature and use permanent password for every BSL firmware upgrade. For that I need to fix the ISR address locations whose value forms the data for BSL password. As of now fixing ISR address is the only option available as custom BSL can't be used due to size limitations.
So how can we fix an ISR address location?
We are using the following ISR in our MSP FW.
Port 1 & 2, ADC, Timer 1,2,3 & i2c
Hi,
To fix the ISR function address, insert following directive under the #pragma vector = xxxx_VECTOR
Then define the section name in the linker file and the section is assigned to a dedicated memory area with your defined address. Please make sure the length is enough to fill the ISR.
Thanks,
Lixin
Hi,
For more detailed demonstration, I can described this solution more detailed.
Two steps:
1) In the formal linker file, define the new MyFRAM and MySection in the MEMORY{...}. Here is an example:
FRAM : origin = 0x8000, length = 0x1000 // note: the FRAM length will be changed due to MyFRAM occupies the FRAM space.
MyFRAM : origin = 0x9002, length = 0x6F70 // note: the new defined section’s length is for the ISR which length needs to cover the ISR function content
2) In the linker file, define the new section .MySection and assign it to the new MyFRAM memory space.
.MySection : {} > MyFRAM
3) Add "#pragma CODE_SECTION (ISR function name, "new_section")" before the interrupt function in the user code. Here is an example to assign TB1_B0 interrupt ISR function to address .MySection which is defined in the linker file.
#pragma vector = TIMER1_B0_VECTOR
#pragma CODE_SECTION (Timer1_B0_ISR, ".MySection");
__interrupt void Timer1_B0_ISR(void)
{
…
}
With these 3 steps, you can assign the fixed address to the interrupt vector table in 0xFF80~0xFFFD so that the BSL password will be fixed.
Thanks,
Lixin
Hi,
Above method will need to calculate the ISR size when defining the memory section for ISR. There is also side-effect for compiler code size optimization for MCUs with small memory size. So we have another method to fix the BSL password for your optional choice:
It is to use the function of set the register SYSRIVECT=1 to map the interrupt table to the top area of RAM.
1) In the linker file, define new memory to map the interrupt vector table to this new FRAM area except reset vector. After code building, the interrupt vector will be in this new area.
2) In the user code, copy the interrupt table to RAM top area, and set the register SYSRIVECT=1.
3) Change the content of 0xFF80 ~ 0xFFFD to assign BSL password (this area will not be changed by code building since there is new defined interrupt vector are). Since the reset vector 0xFFFE will be fixed after user code structure settled down, the BSL password will be fixed.
There is no detailed description for how to change the linker file. We will have this in the future.
Thanks,
Lixin
Hi Lixin,
Thanks for your updates. I Have few doubts:
1) As you have mentioned.
Lixin Chen1 said:1) In the formal linker file, define the new MyFRAM and MySection in the MEMORY{...}. Here is an example:
FRAM : origin = 0x8000, length = 0x1000 // note: the FRAM length will be changed due to MyFRAM occupies the FRAM space.
MyFRAM : origin = 0x9002, length = 0x6F70 // note: the new defined section’s length is for the ISR which length needs to cover the ISR function content
How will we find Interrupt handler function size. As there are multiple ISRs & my MSP FRAM space remaining is less than 1KB, I can't give random length while defining memory for each ISRs.
2) Also in the second method you suggested for fixing MSP BSL PW:
Lixin Chen1 said:2) In the user code, copy the interrupt table to RAM top area, and set the register SYSRIVECT=1.
How can I copy ISR address to RAM top area?
Can you give a code sample which shows which all address of RAM memory is mapped to each ISR addresses. I have tried copying & placing the ISR addresses towards the end of RAM area (<= 0x2FFF (4KB ram from 0x2000 to 0x2FFF)) in the same order that is used in 0xFF88 to 0xFFFF. But my FW is getting hang due to some reason.
Hi,
1) To find the memory size the ISR occupies, you can check the building output .map file or .txt file generated in CCS. If your code is finalized, the code size should be finalized so that you can change the linker file for the start address and length of new MyFRAM memory space.
2) For the second method, it is more flexible for the code building since it is to remap the interrupt vector table into RAM so that it doesn't need to calculate the ISR size. It only needs to change the RAM size (to copy the interrupt vector table) and FRAM size (for new interrupt vector table) in the linker file. We have code examples as attached. There is also user guide document to guide you how to use the reference code. In the Utilities folder, there is small tools (read the Utilities\Linker_Gen\Readme.txt) to generate the linker file for you.
Could you let me know if you download code through BSL from PC or other main MCU?
Thanks,
Lixin
Hi Lixin,
We are flashing MSP from a host processor through BSL UART. We have already integrated and tested the processor side BSL flashing application.
Hi, Rejath,
Does the demo software help you to resolve your issue?
Thanks,
Lixin
Hi Lixin,
Yes it is helpful, I am working on Permanent BSL PW implementation by referring your demo. Thanks for your support.
Hi, Varkey,
Glad to hear the good news.
If my answers helped you to resolve your questions, could you please click on "This resolves my issue" button?
Thanks,
Lixin
**Attention** This is a public forum