In order to facilitate future project upgrades, the CanBoot download function is added to the original program;
1. Place the Bootloader in the high address range (such as 0xEE00~0xFFAF), and then solidify the value of the NVC register to protect this Flash area;
2. Move the interrupt vector. Move the interrupt vector corresponding to the original 0xFFC0 to 0xEDC0.
The code of the bootloader is nothing more than starting, finding the user program entry, jumping to the user program, jumping from the user program to the bootloader, communicating with the host computer (UART or CAN), erasing Flash, writing Flash, etc.
The specific operation is to modify two parts;
1. Modify the Project.prm file and re-divide the partitions. The partitions I divided are as follows:
SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */
Z_RAM = READ_WRITE 0x0080 TO 0x00FF;
RAM = READ_WRITE 0x0100 TO 0x107F;
APP_ROM_ENTRY = READ_ONLY 0xEDB0 TO 0xEDBF;
APP_ROM = READ_ONLY 0x1900 TO 0xEB00;
DATA_ROM = READ_ONLY 0xEB00 TO 0xEDAF;
APP_ROM1 = READ_ONLY 0x1080 TO 0x13FF;
BOOT_ROM = READ_ONLY 0xEE00 TO 0xF8FF;
BOOT_ROM1 = READ_ONLY 0xF900 TO 0xFFAD;
EEPROM = READ_ONLY 0x1400 TO 0x17FF;
/* INTVECTS = READ_ONLY 0xFFC0 TO 0xFFFF; Reserved for Interrupt Vectors */
/* INTVECTS_REL = READ_ONLY 0xEDC0 TO 0xEDFF; Reserved for Relocated Interrupt Vectors */
END
2. Modify the interrupt vector table as follows:
#include "Interrupt.h"
#if (0 == DEBUG_ON)
const char NVPROT_INIT@0xFFBD = 0xFC; //4.5K protection 0xEE00~0xFFFF
const char NVOPT_INIT@0xFFBF = 0x20; //interrupt vector remapping
#endif
extern void _Startup(void);
#pragma CODE_SEG APP_ENTRY
void AppEntry(void)
{
_Startup();
}
#pragma CODE_SEG DEFAULT
extern void ISR_RTC(void);
extern void ISR_Key(void);
void DummyISR(void)
{
for(;;);
}
/*** Redirected interrupt vector table ***/
#if (0 == DEBUG_ON)
const void (* const _VectRedirection[])( ) @0xEDC0 =
#else
const void (* const _VectRedirection[])( ) @0xFFC0 =
#endif
{
DummyISR, // 0xFFC0:ACMP2
DummyISR, // 0xFFC2:ACMP1
DummyISR, // 0xFFC4:MSCAN Transmit
DummyISR, // 0xFFC6:MSCAN Receive
DummyISR, // 0xFFC8:MSCAN Errors
DummyISR, // 0xFFCA:MSCAN Wake Up
ISR_RTC, // 0xFFCC:RTC
DummyISR, // 0xFFCE:IIC
DummyISR, // 0xFFD0:ADC Conversion
ISR_Key, // 0xFFD2:Port A,B,D Pin
DummyISR, // 0xFFD4:SCI2 Transmit
DummyISR, // 0xFFD6:SCI2 Receive
DummyISR, // 0xFFD8:SCI2 Error
DummyISR, // 0xFFDA:SCI1 Transmit
DummyISR, // 0xFFDC:SCI1 Receive
DummyISR, // 0xFFDE:SCI1 Error
DummyISR, // 0xFFE0:SPI
DummyISR, // 0xFFE2:TPM2 Overflow
DummyISR, // 0xFFE4:TPM2 Channel 1
DummyISR, // 0xFFE6:TPM2 Channel 0
DummyISR, // 0xFFE8:TPM1 Overflow
DummyISR, // 0xFFEA:TPM1 Channel 5
DummyISR, // 0xFFEC:TPM1 Channel 4
DummyISR, // 0xFFEE:TPM1 Channel 3
DummyISR, // 0xFFF0:TPM1 Channel 2
DummyISR, // 0xFFF2:TPM1 Channel 1
DummyISR, // 0xFFF4:TPM1 Channel 0
DummyISR, // 0xFFF6:MCG Loss of Lock
DummyISR, // 0xFFF8:Low Voltage Detect
DummyISR, // 0xFFFA:IRQ
DummyISR, // 0xFFFC:SWI
// _Startup, // 0xFFFE:Reset Cannot be redirected
};
Download and modify BootLoader. Please note that when downloading the program with BootLoader, you must first reset dz60 and set the reset voltage according to the power supply voltage of dz60, otherwise the microcontroller may be in a reset state all the time.
Previous article:Nordic52810 Getting Started - Real Time Clock (RTC)
Next article:NRF52840 Learning Process (VI) RTC Real-time Counter (Tick Timer)
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Unboxing: ESP32-S2-KALUGA-1, k210
- Error message when burning uniflash
- Keyi Review: Programmable Linear Constant Voltage Source Based on GP8102
- I saw a short video of a ragpicker hammering an electron tube, and then the person who filmed it quickly bought it!
- WBBSW Silk Screen
- 6ull test
- 【ST NUCLEO-H743ZI Review】(2)Converting serial port and Ethernet port data under LWIP
- RSL10 official information summary -- Baidu Cloud Disk Sharing
- The Evolution of Positioning Technology: The Road to UWB
- GSA: The number of 5G devices exceeds 600