您好,欢迎光临本网站![请登录][注册会员]  
文件名称: R-IN32M3 BootLoader资料
  所属分类: C
  开发工具:
  文件大小: 1mb
  下载次数: 0
  上传时间: 2019-03-04
  提 供 者: weixin_********
 详细说明:瑞萨以太网通讯芯片BootLoader编写资料,专用芯片R-IN32M3R-IN32M3 Series Serial Bootloader 1. Source code With this application note comes source code that should be merged into the r-IN32 Driver/Middleware standard source code tree r-in32m3 samplesoft. The latest R-IN32 middleware can be found at https://www.renesas.com/en-us/products/factory-automation/multi-protocol-communication.html Click on the Sample Software tab, and then"Driver/Middleware Merge the code into the middleware tree at directory level Ir-in32m3 samplesoft Device Renesas RIN32M3 Sourcelproject Include paths needed to compile the bootloader project SPROJ DIRS/ SPROJ D⊥R$/,, ./∴./Inc11de SPROJ DIRS/./././././././CMSIS/Include SPROJ DIRS/./././Middleware/flash CPROJ DIRS/./././Middleware/sflash Defined symbols Define OSlESS if not using an RTOS Define riN32M3 Cl, if using aCL type board for CC-Link II R01AN2580E∪0100Rev.1.00 Page 3 of 19 Feb9.2015 ∈N∈sAs R-IN32M3 Series Serial Bootloader 2. R-IN32 Startup Basics All R-IN32 example code, including the serial bootloader and the user image, are stored in non-volatile memory but executed from rAM. This is because execution directly from flash would be slower The source code projects exist in different configurations depending on where they are mapped to permanent memory, and thus from where the image must be copied at startup The project mode selected for a project must match the board setting as explained below -except for user images where the project mode must be set to RAM Debug. This is because the user image mapping in the ram debug projects are what the bootloader anticipates. That is, the bootloader has macros determining where the user image is expected to reside. The user project mappings in turn are determined by the by the linker configuration file. This can be changed 2.1 Project Modes The bootloader can be set to the project modes" Serial Flash Boot","NOR Boot, or RAM Debug. For the user project, use only ram debug mode. In section 3. 2 we will study how the code boots from memory depending on project mode selection s main-LAR Embedded Workbench IDE Eile Edit f Project I-jet/TAGjet Lools window Hel |多|电息|c| ihex2bin_conv Workspace RAM Debug RAM Debug sh Boot NOR Boot 田口dr rIvers Figure 2. Use Serial or NOR Boot mode for the bootloader project. For the user project use only RAM Debug mode since this matches the bootloader memory region expectations of the user image. 2.11 NOR Boot mode R-IN32 initialization code(Flashloader )copies the serial bootloader startup code from the nor flash(parallel flash, U2 on ther-in32M3-ec board). the code is copied to the ram instruction memory at address o for execution Do not use this mode for the user image, as explained in 5.1 2.1.2 Serial flash boot mode R-iN32 initialization code copies the serial bootloader startup code from serial flash(U3 on R-IN32M3-EC board). The code is copied to the ram instruction memory at address 0 for execution Do not use this mode for the user image, as explained in 5. 2.13 RAM Debug Mode Boot from ram. That is, boot from volatile, non-permanent storage. Typically only used by a toolchain when developing and debugging. For the bootloader the Nor boot and Serial Flash can be used when debugging Use this mode for the user project as explained in 5. 1. Do not use this mode for the bootloader. The bootloader itself will be expanded to ram. at a user image download the bootloader will be overwritten 2.2 Boot Stages Below are the stages wherewith execution proceeds from reset for the r-IN32. This is only given in order to understand the complete boot sequence. The most important aspect here is the second sequence; that Data raM(at 0x2000 0000) is reserved for the bootloader Stage 1. At reset the r-IN32 copies initialization code to the instruction RAM area that starts at address 0 The initialization code is taken from storage depending on project mode and the boot pin settings. The initialization code comes with the toolchain, and the correct settings for the external memory type is added automatically when selecting project mode. For a parallel flash project for example, the init code(e. g R01AN2580E∪0100Rev.1.00 Page 4 of 19 Feb9.2015 ∈N∈sAs R-IN32M3 Series Serial Bootloader copy init and data init functions) will be copied from the parallel flash. Figure 4 illustrates this copying of initialization code Stage 2. The copied bootloader init code is executed. This code in turn copies the actual bootloader from serial or parallel flash to the destination addresses as can be seen in the bootloader map file (INIT Table). the bootloader. The area is determined by the bootloader project linker contiguration file herefore reserved for the destination address for the bootloader code is data ram at ox2000 0000. this area is therefore reserved for the Stage 3. The bootloader is executed Note that the pin setting(rPl0)that determines whether the user image will be executed is not part of these initial stages, but comes into play atter the last stage 13FF FFFFH 13FF FFFFH 13FF FFFFH Extemal Memory Area( csz0 Extemal Memory Extemal Memory (64MB) Area( Cso Area( cso) 64MB) (64MB 10000000H 10000000 10000000H 040B FFFFH 0408 FFFFH 040B FFFFH Instruction RAM Area Instruction RAM Area Instruction RAM Area (768KB) (768KB) (768KB) rong 04000000H 04000000H 04000000H 03 FF FFFFH 03 FF FFFFH 03FF FFFFH Serial flash ROM Area Serial flash ROM Area (32MB) Seral flash ROM Area 2MB (32ME) Mirroring 02000000H 02000000H 02000000H Reserve Reserve Reserve 000B FFFFH 000B FFFFH 000B FFFFH Extemal Memory Serial flash ROM Instruction RAM Area(Csz0) Mirror area Mirror area 00000000H 768KB) 00000 (768KB 0000000H Extermal Memoy Boot Serial flash ROM Extemal Boot BOOT0=0, BOOT1=0 Boot BOOTO-1. BOOT1=0 BOoT0=0. BOOT1=1 Figure 3. A general view of how the R-IN32 copies code to RAM at reset. The code that is copied is initialization code that comes with all projects-except for the RAM Debug projects(which are used for the user images)-and is built in with the toolchain. From left; NOR Boot mode, Serial Boot mode, and RAM mode. The instruction RAM area at address 0 is always used for this purpose and is therefore reserved. See also 6 in related Documents. A more detailed view of all memory is shown in Figure 14 R01AN2580E∪0100Rev.1.00 Page 5 of 19 Feb9.2015 ∈N∈sAs R-IN32M3 Series Serial Bootloader 3. Bootloader Download and Startup This guide does not cover how to set up IAR Embedded workbench for ARM, and how to download the code and use the debugger for a Renesas R-IN32M3 board The serial bootloader must first be downloaded with the toolchain Not until after the bootloader is installed is it possible to update a user main program via a serial port connection At boot, the bootloader is copied into RAM for execution. (The user image is copied into RAM later by the bootloader. The R-iN32 board has different storage locations from where to copy an image; parallel (NOr) flash, serial flash, or even Ram memory when debugging rom-less boards. As discussed in this section, project mode and boot pin settings must match 3.1 Settings 3.1.1 Board See your R-IN32 board user manual under Related Documents above for specific jumper settings etc 3.12 Boot Pins Ther-in32M3-eC has two terminals boot and boot 1. these determine from where the bootloader will be fetched. The voltage setting of these pins must match the bootloader project mode. For the r-IN32M3-EC for example these pins are set via the dip switches " MODE SW"(SW1). Boot mode settings are is reprinted in Figure 4 for convenience.(Related Documents [4, 51. DIP-SW ( SWI Boot mode selection ON(High) ON(High) Instruction RAM boot(test OFF(Low) ON(High) External mpu boot ON(High) OFF(LoW) External serial flash rom boot Do not set for IAR R-INT OFF(LOW) OFF(LOW) External parallel flash rom boot FC Kicks DIP-Sw(SW1) Boot mode selection 2 ON(High ON(High) Instruction RAM boot(test ON(High) OFF(Low) External MPU boot OFF(LOW) ON(High) Extenal serial flash rom boot OFF(Low) OFF(Low) External parallel flash ROM boot Figure 4. Boot mode selection tables for the Tessera r-IN32-EC board and the lar r-In32M3-ec KickStart Kit at top, and the -Cl board at the bottom select a corresponding project mode as shown in Figure 2. Ignore"External MPu boot in this application note 3.1.3 Project To make sure that bootloader command-line strings that are to be sent to the serial port do indeed go to hardware and not a debug terminal, use the settings as shown in Figure 5 for IAR Embedded Workbench R01AN2580E∪0100Rev.1.00 Page 6 of 19 Feb9.2015 ∈N∈sAs R-IN32M3 Series Serial Bootloader Catagory: Category: GenerslOpbicns Runtime Checking Assembler Target Output Libray Cortigura: on Library Opions MISRA C: 20C4p C/C++ Compier Target Output Library Conrigurabian Lbrary OphiorsMISRA C: P Outpu Converter Output (inverter Custom buid Printf formatter Buil Actions Use the o' mal configur Build actions fle descriptor support, no mualibytes in pinf and Linker Automatc choice of for matter Simulater Configurator file $TOOLKIT DIRS\NC\c\DLib Conig Normal DB Server IAR ROM-monitor Enable thread support n lbrary IAR ROM-monibor to L ihraty lnw leve interface implementation Link/)-Trace Automatic choice of formatteR Nui sTub./suen TI Stearns USe CMSIS o Semhosted o Via semhosting Mlacraigor a DSP library Mlacraigor o Via Swo FE micro □ Buttered terminal auru ST-LINF ST-LINK ird-Party Driver XDS100/ 200/ICDI XD100200Ic Cancel Figure 5. To make sure that bootloader serial output data will properly arrive at the serial port terminal when using the IAR toolchain, use semihosting and uncheck"Buffered terminal output" To run the bootloader on the target board, connect the debugger, power the board, compile, link, download and run the binary. Section 6 describes a hands-on session where the bootloader is run and a user image is downloaded 3.2 Bootloader Startup Behavior After startup of the serial bootloader its further behavior depends on both the value of a hardware port and on whether there is user flash code at the expected address 3.2.1 Hardware Port Setting If pin RP10 (RealTime port 10)is at the high voltage level (switch is oN) the bootloader program is always executed regardless of the state of the user image. This corresponds to Sw6-1 in the OFF position on the Tessera EC board 3.2.2 User Flash Image conten (a) Serial flash storage If the 16 bytes at the start address of serial flash, that is at address 0x0202 0000 (SFLASH BASE ADDRESS MAIN PROGRAM ADDRESS), are all OxFF, the bootloader is executed Otherwise execution is started at the main user code program. That is, the normal product application is run (b) NOR (parallel) flash If the 16 bytes at the start address of parallel flash, at Ox1002 0000, are all OxFF, the bootloader is run. Otherwise the main user code program is executed. Observe that using parallel flash is not available when using the IAr KSK R01AN2580E∪0100Rev.1.00 Page of 19 Feb9.2015 ∈N∈sAs R-IN32M3 Series Serial Bootloader Bootloader start RP10 high? OR- 16 B at start of us er area all eeh? True False Bootloa der command ready start user program OIRAM BASE ADDRESS end Figure 6. After a reset bootloader startup behavior determines whether to execute the user image. The user image is executed from the reset vector if it deemed to be ok and if rPlo is low. Otherwise the bootloader is started and enters the command mode 3.2.3 Faulty Image Protection If there is code in the user image area as determined above, the user application should be checked further for correctness before execution. The above user execution startup scheme is provided as example only. The user should provide for added protection against execution of a faulty image by means of an image checksum e.g. within a user image header field with a fixed address known by the bootloader. A user header can contain fields such as image checksum. version number. etc. The header field should be added to the user image, and the address to it and checksum calculation routine etc added to the bootloader R01AN2580E∪0100Rev.1.00 Page 8 of 19 Feb9.2015 ∈N∈sAs R-IN32M3 Series Serial Bootloader 4. Serial terminal 4.1 PC Settings Control of the serial boot loader is done using a command set from over a COM port connection to the r-IN32 board Connect a USB A to Mini-B cable between a PC and the board's UART (USB)connector Start a serial terminal program and select the virtual Com port number that belongs to the R-IN32. The settings used for the PCs serial terminal program in order to be able to access the r-iN32 are shown in Figure 7 and Figure 8 Item Setting Baud rate 115200bps Data bit length 8 bit Parity bit None Stop bit length 1 bit Flow control Hardware control Terminal setting TX: CR+LF Figure 7. CoM port settings for the PC serial terminal program. Tera Term: Terminal setup Terminal size New -line OK X24 Receive: CR v Term size win size Transmit:CR+LF Cancel □ Auto window resize CR CR+LF Terminal ID:VT100[Local echo Answerback L Auto switch (VT<->TEK) KanJi(receIve) KanJ(transmit) UTF-8 UTF-8 Karnl-n A[SB a Zbit katakana [ 7bit katakana Kanji-out[(B ocale. anese Code Page: 932 Figure 8. Note the Cr+LF setting needed in the Pc serial terminal settings. If the connection is correct, you should see a prompt in your serial terminal program R_工N32M3> You can find the COM-port number for the Pc by e. g. opening Device Manager. Type a help text showing the bootloader's control commands should be shown R-IN32M3>help R01AN2580E∪0100Rev.1.00 Page 9 of 19 Feb9.2015 ∈N∈sAs R-IN32M3 Series Serial Bootloader COMAO- 115200baud- Tera Term VT Boot-loader program for R-IN32M3 (build: Jan 13 2015 13: 46:13> t command -interface nod [Comnand list] He lp command Display this message e to the Flash ROM. Inage file format is the inte l-hex format bt img Boot inage command Boot the image from the Flash RoM lash ROM Write command Write a 1-16 Byte data on the Flack addr- base address Size of erase sector R-IN32M3> Figure 9. If the bootloader is running and the pc's usb virtual com port is set up correctly, typing in the pc terminal should show the bootloader command set 4.2 Bootloader commands Here follows the complete command set The command is followed by none, one or more arguments Command argument Argument o lArgumentNll Address parameter values are not absolute but relative to the serial flash memory. That is, the start of the memory device address is zero The serial flash is at absolute address oxo200 o000 but commands are relative to the serial flash nternally and so addressing starts at zero Since the user image starts at absolute address 0x0202 0000 one must to read the very beginning of the user image enter e R-N32M3>fY2000030 to read the first 30h bytes of the user image. Figure 14 includes the flash memory map to the right Command Task Description help Hel Shows all commands and their parameters Write a user Upload a user image file to the flash memory The image upimg image to flash stream format must be Intel Hex. See Figure 10 ROM Data record lines(type 00)should have Oxl0 bytes of data Execute a Sw Executes the main program uploaded to flash memory bing mage rP10 does not need to be set low before the command. s1 Write data to Writes 1 to 16 bytes to the flash mer fw address [data flash memory fr address length Read flash Reads length] bytes from the flash memory. *2 memory Erase flash Erases [length] sector of data from the flash memory fe address] [length memory The sector number is given as parameter, or use all *1. IfRP10 pin is low, after RESET, user program will start without bootloader control *2. Arguments must be in hexadecimal format; without a leading"Ox 3. Can bc inserted with a variable lcngth of 16 B from I to 2 [data R01AN2580E∪0100Rev.1.00 Page 10 of 19 Feb9.2015 ∈N∈sAs
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: R-IN32M3BootLoader资料
 输入关键字,在本站1000多万海量源码库中尽情搜索: