I have been trying to develop a serial bootloader based on AN2295 for TWR-K60D100M.
Implemented the following ;
1. Serial bootloader is good working.
2. I used win_hc08sprg.exe tool on my PC.
3. I successed to download and erase, program my gpio application modified .lcf file to TWR-K60 board
I refered to AN2295 pdf file, and modified .lcf file in my gpio application project.
This my gpio application is good working in non bootloader environment(this means not modified .lcf file)
4. But the application with the modified .lcf file is not working.
/* This is original MEMORY SECTION
MEMORY {
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x000001E0
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0007FBF0
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
m_data_20000000 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000
m_cfmprotrom (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
}
*/
// This is modified according to AN2295 document
MEMORY {
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x000001E0
m_text (RX) : ORIGIN = 0x00004410, LENGTH = 0x0007FFFF-0x00004410
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
m_data_20000000 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000
m_cfmprotrom (RX) : ORIGIN = 0x00004400, LENGTH = 0x00000010
}
5. I followed the AN2295 document to load my application on the serial bootloader.
Please advise me to success writing an application with serial bootloader support.
已解决! 转到解答。
Hello,
Your App linker file should be like below. I have used only with MQX App, but bare metal App is similar:
MEMORY {
serial_bootloader (RX) : ORIGIN=0x00000000, LENGHT = 0x00004000
m_interrupts (RX) : ORIGIN = 0x00004000, LENGTH = 0x00000410
m_text (RX) : ORIGIN = 0x00004420, LENGTH = 0x0007FFFF-0x00004420
m_data (RW) : ORIGIN = 0x1FFF0400, LENGTH = 0x0001FC00
m_data_20000000 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000
}
You don't need the cfmprotrom again, is defined in the bootloader. Remove that section.
And reserve 0x400 for the RAM vectors.
And your application needs to reallocate the vectors to RAM before procesing interrupts.
// Copy Application Stored Interrupt Vector table to RAM
pdst=(uint_32*)0x1FFF0000;
psrc=(uint_32*)0x4000;
for (i=0;i<0x100;i++,pdst++,psrc++)
{
*pdst=*psrc;
}
Then redirect the vector table to RAM by changing the SCB_VTOR like this:
// Redirect the vector table to the new copy in RAM
SCB_VTOR = (uint_32)0x1FFF0000;
Best Regards,
Luis
Hello,
Your App linker file should be like below. I have used only with MQX App, but bare metal App is similar:
MEMORY {
serial_bootloader (RX) : ORIGIN=0x00000000, LENGHT = 0x00004000
m_interrupts (RX) : ORIGIN = 0x00004000, LENGTH = 0x00000410
m_text (RX) : ORIGIN = 0x00004420, LENGTH = 0x0007FFFF-0x00004420
m_data (RW) : ORIGIN = 0x1FFF0400, LENGTH = 0x0001FC00
m_data_20000000 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000
}
You don't need the cfmprotrom again, is defined in the bootloader. Remove that section.
And reserve 0x400 for the RAM vectors.
And your application needs to reallocate the vectors to RAM before procesing interrupts.
// Copy Application Stored Interrupt Vector table to RAM
pdst=(uint_32*)0x1FFF0000;
psrc=(uint_32*)0x4000;
for (i=0;i<0x100;i++,pdst++,psrc++)
{
*pdst=*psrc;
}
Then redirect the vector table to RAM by changing the SCB_VTOR like this:
// Redirect the vector table to the new copy in RAM
SCB_VTOR = (uint_32)0x1FFF0000;
Best Regards,
Luis