Download presentation
Presentation is loading. Please wait.
Published byElvin Ryan Modified over 8 years ago
1
Class ID: Renesas Electronics America Inc. © 2012 Renesas Electronics America Inc. All rights reserved. Implementing Bootloaders on Renesas MCUs
2
© 2012 Renesas Electronics America Inc. All rights reserved.2 Renesas Technology & Solution Portfolio
3
© 2012 Renesas Electronics America Inc. All rights reserved.3 Microcontroller and Microprocessor Line-up Wide Format LCDs Industrial & Automotive, 130nm 350µA/MHz, 1µA standby 44 DMIPS, True Low Power Embedded Security, ASSP 165 DMIPS, FPU, DSC 1200 DMIPS, Performance 1200 DMIPS, Superscalar 500 DMIPS, Low Power 165 DMIPS, FPU, DSC 25 DMIPS, Low Power 10 DMIPS, Capacitive Touch Industrial & Automotive, 150nm 190µA/MHz, 0.3µA standby Industrial, 90nm 200µA/MHz, 1.6µA deep standby Automotive & Industrial, 90nm 600µA/MHz, 1.5µA standby Automotive & Industrial, 65nm 600µA/MHz, 1.5µA standby Automotive, 40nm 500µA/MHz, 35µA deep standby Industrial, 40nm 200µA/MHz, 0.3µA deep standby Industrial, 90nm 1mA/MHz, 100µA standby Industrial & Automotive, 130nm 144µA/MHz, 0.2µA standby 2010 2012 32-bit 8/16-bit
4
© 2012 Renesas Electronics America Inc. All rights reserved.4 In a smart society devices can add features and fix bugs after leaving store shelves. Having a bootloader in your system allows you to sleep better at night. ‘Enabling The Smart Society’ Firmware v1.2 ??? Firmware v3.0 v4.0v1.3 Added Multitasking Fixed focusing bug
5
© 2012 Renesas Electronics America Inc. All rights reserved.5 Agenda Quick bootloader overview The flash loader framework Design choices RX implementation RL78 implementation Lab
6
© 2012 Renesas Electronics America Inc. All rights reserved.6 Quick Bootloader Overview
7
© 2012 Renesas Electronics America Inc. All rights reserved.7 Quick Bootloader Overview What is a bootloader? What can a bootloader do? Erase and rewrite user memory Validate user memory Communicate with the outside world Download new application in case of failure What should a bootloader be? Reset Bootloader Application
8
© 2012 Renesas Electronics America Inc. All rights reserved.8 Available Boot Options Factory bootloader Cannot be modified User code cannot run Can program/erase everything User boot area Programmed with USB from factory Uses CPU rewrite code User application Uses CPU rewrite code MCU Address Space Factory Bootloader RAM User Boot Area User Application Area P/E
9
© 2012 Renesas Electronics America Inc. All rights reserved.9 The Flash Loader Project
10
© 2012 Renesas Electronics America Inc. All rights reserved.10 What is the Flash Loader Project? Flexible system for implementing in-field-reprogramming in your own project Communications medium agnostic Modify to fit your system Retries & error checking built in Does not interfere with user application
11
© 2012 Renesas Electronics America Inc. All rights reserved.11 Terms Device Storage v4.2 Host Load Image
12
© 2012 Renesas Electronics America Inc. All rights reserved.12 Checking…Downloading … Storing … Reprogramming … Parts of the Flash Loader Project? Flexible system that can be split into 2 parts: Downloader Bootloader Host Device Storage
13
© 2012 Renesas Electronics America Inc. All rights reserved.13 1: Using Flash Loader With Your Project
14
© 2012 Renesas Electronics America Inc. All rights reserved.14 Add Flash Loader to your HEW Project Add flash loader project files Enables future updates Flash loader bootloader is separate project User’s Project User Application Flash Loader +
15
© 2012 Renesas Electronics America Inc. All rights reserved.15 Configure Flash Loader for Your System r_fl_app_header.c r_fl_comm_*type*.c r_fl_downloader.c r_fl_store_manager.c r_fl_memory_*type*.c r_fl_utilities.c Host Device Storage v4.2 = Edit for your configuration
16
© 2012 Renesas Electronics America Inc. All rights reserved.16 2: Making a Load Image
17
© 2012 Renesas Electronics America Inc. All rights reserved.17 © 2010 Renesas Electronics America Inc. All rights reserved. Making a Load Image S-Record (“MOT”) files are inefficient S-Record Converter Load image information: Binary Starts with header Has N blocks Load Image HeaderBlock 1 Block 2Block N... MOT S-Record Converter Load Image 60KB 20KB
18
© 2012 Renesas Electronics America Inc. All rights reserved.18 Load Image Header © 2010 Renesas Electronics America Inc. All rights reserved. FieldSize in Bytes Valid mask1 Image ID1 Version number1 Size of load image4 Max block data size4 Load image CRC2 Raw CRC2 Address of 1 st data block4 Successfully stored?4
19
© 2012 Renesas Electronics America Inc. All rights reserved.19 3: Obtaining the Load Image
20
© 2012 Renesas Electronics America Inc. All rights reserved.20 Transferring the Load Image Flash loader is medium agnostic Communications protocol is supplied Supported commands Information request Erase image from storage Load image download Host Device Storage
21
© 2012 Renesas Electronics America Inc. All rights reserved.21 Storing the Load Image As Load blocks come in: Check for errors Store Storage area partitioned for load images If error occurs, retry is possible Host Device Storage Load Block
22
© 2012 Renesas Electronics America Inc. All rights reserved.22 Storage What the Storage Area Looks Like Load images are in different ‘partitions’ Load Image #1 – Address 0x00100000 HeaderBlock 1Block 2Block 3 Block 512 … Load Image #2 – Address 0x00200000 HeaderBlock 1Block 2Block 3 Block 656 … Load Image #3 – Address 0x00300000 EMPTY
23
© 2012 Renesas Electronics America Inc. All rights reserved.23 4: Using the Load Image
24
© 2012 Renesas Electronics America Inc. All rights reserved.24 Reboot & Flash Reboot when convenient Check for new load image If valid, reflash MCU Jump to user application and execute Host Device Storage Load Image
25
© 2012 Renesas Electronics America Inc. All rights reserved.25 Design Choices
26
© 2012 Renesas Electronics America Inc. All rights reserved.26 Bootloader Decisions Why not store bootloader in same memory area as user application? Bug in control code could erase everything Application must be aware of bootloader Why not store load images in MCU memory? Hard to make bootloader not interfere with user application Bug in control code could erase currently running application Limit application size or pay more Move code to RAM May have to use PIC and PID Keep safe older revisions
27
© 2012 Renesas Electronics America Inc. All rights reserved.27 RX Implementation
28
© 2012 Renesas Electronics America Inc. All rights reserved.28 Flash Loader Bootloader Separate workspace Separate memory areas Can use same or different communications as FL downloader User Boot is special User Application & Flash Loader Downloader Flash Loader Bootloader MCUMCU User ROMUser Boot Area
29
© 2012 Renesas Electronics America Inc. All rights reserved.29 Why is User Boot Special? Can execute from either reset vector on start-up Cannot accidentally erase Should have ‘one and done’ attitude No indirection tables! Single-Chip Mode Reset Vector User Boot Mode Reset Vector
30
© 2012 Renesas Electronics America Inc. All rights reserved.30 Storing Load Images By default stored in external SPI flash RX cannot read from ROM while writing or erasing ROM Large stalls in user application or move to RAM No chance of losing image Cost of SPI flash is usually lower than doubling MCU ROM It’s so much easier!
31
© 2012 Renesas Electronics America Inc. All rights reserved.31 RL78 Implementation
32
© 2012 Renesas Electronics America Inc. All rights reserved.32 Dual Boot Blocks Has 2 independent boot blocks Can swap which one is used Removes problem of losing everything Still recommend external SPI flash
33
© 2012 Renesas Electronics America Inc. All rights reserved.33 Using Boot Swap Download new image Swap to bootloader block Program in image Swap to application block
34
© 2012 Renesas Electronics America Inc. All rights reserved.34 Summary Quick bootloader overview The flash loader framework Design choices RX implementation RL78 implementation Lab
35
© 2012 Renesas Electronics America Inc. All rights reserved.35 Questions?
36
© 2012 Renesas Electronics America Inc. All rights reserved.36 In a smart society devices can add features and fix bugs after leaving store shelves. Have a bootloader in your system allows you to sleep better at night. ‘Enabling The Smart Society’ Firmware v1.2 ??? Firmware v3.0 v4.0v1.3 Added Multitasking Fixed focusing bug
37
Renesas Electronics America Inc. © 2012 Renesas Electronics America Inc. All rights reserved.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.