📄 canio.lst
字号:
MPASM 03.20.08 Intermediate CANIO.ASM 2-3-2003 15:42:14 PAGE 1
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00001
00002 ;*****************************************************************************
00003 ;*
00004 ;* Microchip CAN Bootloader
00005 ;*
00006 ;*****************************************************************************
00007 ;* FileName: CANIO.asm
00008 ;* Dependencies:
00009 ;* Processor: PIC18F with CAN
00010 ;* Assembler: MPASMWIN 03.10.04 or higher
00011 ;* Linker: MPLINK 03.10.04 or higher
00012 ;* Company: Microchip Technology Incorporated
00013 ;*
00014 ;* Software License Agreement
00015 ;*
00016 ;* The software supplied herewith by Microchip Technology Incorporated
00017 ;* (the "Company") is intended and supplied to you, the Company's
00018 ;* customer, for use solely and exclusively with products manufactured
00019 ;* by the Company.
00020 ;*
00021 ;* The software is owned by the Company and/or its supplier, and is
00022 ;* protected under applicable copyright laws. All rights are reserved.
00023 ;* Any use in violation of the foregoing restrictions may subject the
00024 ;* user to criminal sanctions under applicable laws, as well as to
00025 ;* civil liability for the breach of the terms and conditions of this
00026 ;* license.
00027 ;*
00028 ;* THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,
00029 ;* WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
00030 ;* TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00031 ;* PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
00032 ;* IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
00033 ;* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
00034 ;*
00035 ;*
00036 ;* Basic Operation:
00037 ;* The following is a CAN bootloader designed for PIC18F microcontrollers
00038 ;* with built-in CAN such as the PIC18F458. The bootloader is designed to
00039 ;* be simple, small, flexible, and portable.
00040 ;*
00041 ;* The bootloader can compiled to one of two major modes of operation:
00042 ;*
00043 ;* PG Mode: In this mode the bootloader allows bi-directional communication
00044 ;* with the source. Thus the bootloading source can query the
00045 ;* target and verify the data being written.
00046 ;*
00047 ;* P Mode: In this mode the bootloader allows only single direction
00048 ;* communication, i.e. source -> target. In this mode programming
00049 ;* verification is provided by performing self verification and
00050 ;* checksum of all written data (except for control data).
00051 ;*
00052 ;* The bootloader is essencially a register controlled system. The control
00053 ;* registers hold information that dictates how the bootloader functions.
MPASM 03.20.08 Intermediate CANIO.ASM 2-3-2003 15:42:14 PAGE 2
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00054 ;* Such information includes a generic pointer to memory, control bits to
00055 ;* assist special write and erase operations, and special command registers
00056 ;* to allow verification and release of control to the main application.
00057 ;*
00058 ;* After setting up the control registers, data can be sent to be written
00059 ;* to or a request can be sent to read from the selected memory defined by
00060 ;* the address. Depending on control settings the address may or may not
00061 ;* automatically increment to the next address.
00062 ;*
00063 ;* Commands:
00064 ;* Put commands received from source (Master --> Slave)
00065 ;* The count (DLC) can vary.
00066 ;* XXXXXXXXXXX 0 0 8 XXXXXXXX XXXXXX00 ADDRL ADDRH ADDRU RESVD CTLBT SPCMD CPDTL CPDTH
00067 ;* XXXXXXXXXXX 0 0 8 XXXXXXXX XXXXXX01 DATA0 DATA1 DATA2 DATA3 DATA4 DATA5 DATA6 DATA7
00068 ;*
00069 ;* The following responce commands are only used for PG mode.
00070 ;* Get commands received from source (Master --> Slave)
00071 ;* Uses control registers to get data. Eight bytes are always assumed.
00072 ;* XXXXXXXXXXX 0 0 0 XXXXXXXX XXXXXX10 _NA__ _NA__ _NA__ _NA__ _NA__ _NA__ _NA__ _NA__
00073 ;* XXXXXXXXXXX 0 0 0 XXXXXXXX XXXXXX11 _NA__ _NA__ _NA__ _NA__ _NA__ _NA__ _NA__ _NA__
00074 ;*
00075 ;* Put commands sent upon receiving Get command (Slave --> Master)
00076 ;* YYYYYYYYYYY 0 0 8 YYYYYYYY YYYYYY00 ADDRL ADDRH ADDRU RESVD STATS RESVD RESVD RESVD
00077 ;* YYYYYYYYYYY 0 0 8 YYYYYYYY YYYYYY01 DATA0 DATA1 DATA2 DATA3 DATA4 DATA5 DATA6 DATA7
00078 ;*
00079 ;* Put commands sent upon receiving Put command (if enabled) (Slave --> Master)
00080 ;* This is the acknowledge after a put.
00081 ;* YYYYYYYYYYY 0 0 0 YYYYYYYY YYYYYY00 _NA__ _NA__ _NA__ _NA__ _NA__ _NA__ _NA__ _NA__
00082 ;* YYYYYYYYYYY 0 0 0 YYYYYYYY YYYYYY01 _NA__ _NA__ _NA__ _NA__ _NA__ _NA__ _NA__ _NA__
00083 ;*
00084 ;* ADDRL - Bits 0 to 7 of the memory pointer.
00085 ;* ADDRH - Bits 8 - 15 of the memory pointer.
00086 ;* ADDRU - Bits 16 - 23 of the memory pointer.
00087 ;* RESVD - Reserved for future use.
00088 ;* CTLBT - Control bits.
00089 ;* SPCMD - Special command.
00090 ;* CPDTL - Bits 0 - 7 of special command data.
00091 ;* CPDTH - Bits 8 - 15 of special command data.
00092 ;* DATAX - General data.
00093 ;*
00094 ;* Control bits:
00095 ;* MODE_WRT_UNLCK - Set this to allow write and erase operations to memory.
00096 ;* MODE_ERASE_ONLY - Set this to only erase Program Memory on a put command. Must
00097 ;* be on 64 byte boundary.
00098 ;* MODE_AUTO_ERASE - Set this to automatically erase Program Memory while writing data.
00099 ;* MODE_AUTO_INC - Set this to automatically increment the pointer after writing.
00100 ;* MODE_ACK - Set this to generate an acknowledge after a 'put' (PG Mode only)
00101 ;*
00102 ;* Special Commands:
00103 ;* CMD_NOP 0x00 Do nothing
00104 ;* CMD_RESET 0x01 Issue a soft reset
00105 ;* CMD_RST_CHKSM 0x02 Reset the checksum counter and verify
00106 ;* CMD_CHK_RUN 0x03 Add checksum to special data, if verify and zero checksum
MPASM 03.20.08 Intermediate CANIO.ASM 2-3-2003 15:42:14 PAGE 3
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00107 ;* then clear the last location of EEDATA.
00108
00109 ;* Memory Organization:
00110 ;* |-------------------------------|
00111 ;* | | 0x0000
00 (Do not write here!)
00112 ;* | Boot Area |
00113 ;* | |
00114 ;* |-------------------------------|
00115 ;* | |
00116 ;* | |
00117 ;* | |
00118 ;* | |
00119 ;* | Prog Mem |
00120 ;* | |
00121 ;* | |
00122 ;* | |
00123 ;* | | 0x1FFF
FF
00124 ;* |-------------------------------|
00125 ;* | User ID | 0x200000
00126 ;* |-------------------------------|
00127 ;* |:::::::::::::::::::::::::::::::|
00128 ;* |:::::::::::::::::::::::::::::::|
00129 ;* |-------------------------------|
00130 ;* | Config | 0x300000
00131 ;* |-------------------------------|
00132 ;* |:::::::::::::::::::::::::::::::|
00133 ;* |:::::::::::::::::::::::::::::::|
00134 ;* |-------------------------------|
00135 ;* | Device ID | 0x3FFFFE
00136 ;* |-------------------------------|
00137 ;* |:::::::::::::::::::::::::::::::|
00138 ;* |:::::::::::::::::::::::::::::::|
00139 ;* |:::::::::::::::::::::::::::::::|
00140 ;* |:::::::::::::::::::::::::::::::|
00141 ;* |-------------------------------|
00142 ;* | | 0xF000
00
00143 ;* | EEDATA |
00144 ;* | (remapped) |
00145 ;* | | (Last
byte used as boot flag)
00146 ;* |-------------------------------|
00147 ;*
00148 ;*
00149 ;* Author Date Comment
00150 ;*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00151 ;* Ross Fosler 11/26/02 First full revision
00152 ;*
00153 ;*****************************************************************************/
00154
00155
MPASM 03.20.08 Intermediate CANIO.ASM 2-3-2003 15:42:14 PAGE 4
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00156
00157
00158
00159 ; *****************************************************************************
00160 #include p18cxxx.inc
00001 LIST
00002 ; P18CXXX.INC Standard Header File, Version 1.00 Microchip Technology, Inc.
00001 LIST
00002 ; P18F458.INC Standard Header File, Version 0.10 Microchip Technology, Inc.
01508 LIST
00070 ENDIF
00071 IFDEF __18C601
00072 INCLUDE <P18C601.INC>
00073 ENDIF
00074 IFDEF __18C658
00075 INCLUDE <P18C658.INC>
00076 ENDIF
00077 IFDEF __18C801
00078 INCLUDE <P18C801.INC>
00079 ENDIF
00080 IFDEF __18C858
00081 INCLUDE <P18C858.INC>
00082 ENDIF
00083 IFDEF __18F1220
00084 INCLUDE <P18F1220.INC>
00085 ENDIF
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -