mc9s08dz60 adds BootLoader to implement CANboot download and update function

Publisher:丝语轻风Latest update time:2021-04-19 Source: eefocusKeywords:mc9s08dz60  BootLoader Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

 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.


Keywords:mc9s08dz60  BootLoader Reference address:mc9s08dz60 adds BootLoader to implement CANboot download and update function

Previous article:Nordic52810 Getting Started - Real Time Clock (RTC)
Next article:NRF52840 Learning Process (VI) RTC Real-time Counter (Tick Timer)

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号