MCU的启动方式有很多种:UART接口,扩展的静态存储单元(NOR Flash),

SPI Flash,quad SPI Flash,高速USB0和USB1.另外可以通过对OTP存储单元的编程。

首先看下内存映射:

在MCU复位之后,ARM处理器将会从ROM区域执行代码。

LPC43XX包含一个隐藏指针允许内存区域映射到地址0x00000000.

隐藏指针的默认值为0x1040 0000,保证了启动ROM中的代码在复位的时候被执行。

如果启动方式从flash区域开始,那么系统默认会从内部flash启动(引脚p2_7为高)。

如果p2_7引脚在复位的时候取样为低,启动方式将由OTP的 BOOT_SRC位 的设置

或者引脚P2_9,P2_8,P1_2,P1_1的状态而定。

如果BOOT_SRC位被设置,根据值的不同启动的方式不同:

注意:

OTP内存区域属于一次性编程性质,一旦用户在某一程序中设定了其中的值,

那么系统的启动方式就确定了,不能再次进行更改,这个部分一定要注意。

否则,有可能会因为启动方式的定性而导致后续编程的不方便。

如果p2_7引脚在复位的时候取样为低, OTP内存没有经过编程[1111] 或者BOOT_SRC位为 [0000]

启动模式由引脚P2_9,P2_8,P1_2,P1_1的状态决定。

When programming and running code from the external flash, it is particularly important to make sure that

you have the boot pins P2_9, P2_8, P1_2, and P1_1 are correctly connected so that the MCU starts execution from the correct memory address.

For more details, please see the NXP documentation.

If the boot pins are incorrectly set, then this will typically result in the initial default breakpoint set by the debugger on main() not been reached.

You can confirm if this is the case by clicking on suspend icon to pause execution (when you fail to hit the initial breakpoint)

and then looking at the address of the PC.

If you built for SPIFI, then the address of the PC should be 0x14xx xxxx,

whereas if you built for EMC (SST), then the address of the PC should be0x1Cxx xxxx.

BOOT pins example (Hitex LPC1850/4350 board)

For example, for the Hitex LPC1850/4350 board, you need to have the BOOT jumpers configued as follows :

  • For SPIFI flash

    • BOOT1 connected across pins 1 and 2
    • BOOT2, BOOT3, BOOT4 connected across pins 2 and 3
  • For EMC SST flash

    • BOOT1, BOOT2 connected across pins 1 and 2
    • BOOT3, BOOT4 connected across pins 2 and 3

Note :

A power on reset is definitely required after changing the BOOT pin settings.

The boot ROM memory includes the following features:

• ROM memory size is 64 kB.
• Supports booting from UART interfaces, external static memory such as NOR flash, SPI flash, quad SPI flash, high-speed USB (USB0), and USB1.
• Includes API for OTP programming.
• Includes USB drivers.
• ISP mode for loading data to on-chip SRAM and execute code from this location.

The internal ROM memory is used to store the boot code.

After a reset, the ARM processor will start its code execution from this memory.

The ARM core is configured to start executing code, upon reset, with the program counter being set to the value 0x0000 0000.

The LPC43xx contains a shadow pointer that allows areas of memory to be mapped to address 0x0000 0000.

The default value of the shadow pointer is 0x1040 0000, ensuring that the code contained in the boot ROM is executed at reset.

For flash-based parts, the part boots from internal flash by default (boot pin P2_7 is HIGH).

If the boot pin is sampled LOW on reset, the boot source is determined

by the setting of the OTP or the states of pins P2_9, P2_8, P1_2, and P1_1.

For details of the boot process for flash-based parts, see Figure 13.

For flash-based and flashless parts alike, several external sources are available for booting depending

on the values of the OTP bits BOOT_SRC (see Section 4.4).

If the OTP memory is not programmed or the BOOT_SRC bits are all zero,

the boot mode is determined by the states of the boot pins P2_9, P2_8, P1_2, and P1_1.

OTP BOOT_SRC = 0000 : uses External Pins

BOOT_SRC = 0000 : uses External Pins -- Programmed

BOOT_SRC = 1111 : uses External Pins -- Unprogrammed

BOOT_SRC = 0000 : uses External Pins                                                                                                                                                                                      

Set the boot mode jumpers to USB0: BOOT[0:3] = "1010".

P1_1 = BOOT[0], P1_1 = BOOT[1], P2_8 = BOOT[2], P2_9 = BOOT[3]

P2_7 = 0 : ISP < USART0 or USART3 >

Boot process for parts with internal flash

Parts with flash boot from on-chip flash if PIO2_7 is sampled HIGH. See Figure 13.

If pin P2_7 is sampled LOW, the boot loader checks the OTP bits

and/or the external boot pins to determine the communication port.

If the OTP bits and boot pins are set to USART0 or USART3, the part enters UART ISP mode.

A boot image must have a valid signature to be a valid flash image (see Section 6.4.4.1 “Criterion for Valid User Code”),

and on parts with dual flash banks, only one flash bank should contain a valid image.

You can use the ISP/IAP command Set active boot flash bank to configure one flash bank

with the valid image (see Section 6.8.12 and Section 6.7.15).

If both images are valid, the boot loader loads the image located in flash bank A.

Remark:

If the boot loader image is located in flash bank B and data is stored in flash bank A,

then ensure that the data in flash bank A does not appear to be a valid image.

An example of a data set that would be interpreted as a valid image is a set in which the first eight words of flash bank A contain all zeros.

This implies that the data in the first 8 locations of sector 0 in flash bank A cannot be chosen freely.

For example, choose data in location 8 in such a way that a non-valid image is created. See Section 6.4.4.1 “Criterion for Valid User Code”.

Boot process for parts without flash

The top level boot process is illustrated in Figure 14.

The boot starts after Reset is released.

The IRC is selected as CPU clock,the Cortex-M4 starts the boot loader, and JTAG access is enabled.

As shown in Figure 14, the boot ROM determines the boot mode based on the OTP BOOT_SRC value

or reset state of the pins P1_1, P1_2, P2_8, and P2_9.

The boot ROM copies the image to internal SRAM at location 0x1000 0000

and jumps to that location (it sets ARM's to 0x1000 0000) after image verification.

Hence the images for LPC43xx should be compiled with entry point at 0x0000 0000.

On AES capable parts with a programmed AES key, the image and header

are authenticated using the CMAC algorithm prior to copying to the internal SRAM.

If authentication fails the device is reset.

On non-secure parts, the image and header are not authenticated.

If the image is not preceded by a header then the image is not copied to SRAM but assumed to be executable as-is.

In that case the shadow pointer is set to the first address location of the external boot memory.

The header-less images should be compiled with entry point at 0x0000 0000, the same as for an image with header.

Remark:

When the boot process fails, pin P1_1 toggles at a 1 Hz rate for 60 seconds.

After 60 seconds, the device is reset.

Jellybean Notes

A 12 MHz clock signal must be supplied to the LPC4330 at boot time.

 "This boot mode requires that a 12 MHz external crystal is connected to the XTAL1/2 pins."

The April 16, 2012 Jellybean design has a voltage divider for VBUS that is fed to the LPC43xx

to detect that a USB host is present.

Measuring the divided voltage, the USB0_VBUS only reaches 0.4V,

which fails to trip the USB bootloader code.

It looks like NXP's intent is to directly connect VBUS to the USB0_VBUS.

Indeed, when I shorted R10 with tweezers, the USB bootloader sprung into action.

I would recommend changing R10 to 0 Ohms and R11 to DNP, or removing R10 and R11 altogether.

DFU/USB boot board configurations

To use DFU/USB boot with the LPC18xx/43xx devices, the chip needs to be configured with the boot jumpers for DFU/USB boot.

LPC18xx/43xx devices can boot via the USB0 or USB1 port.

Hitex 1850 and 4350 board

To setup the Hitex 1850 or 4350 boards for USB DFU boot mode,

configure the BOOT1 - BOOT4 jumpers as follows:

  • BOOT1 pins 1-2
  • BOOT2 pins 3-4
  • BOOT3 pins 1-2
  • BOOT4 pins 3-4

Plug the USB cable into the USB0 connector for DFU boot.

Keil MCB1857 and MCB4357 boards

The MCB1857 and MCB4357 boards have devices with internal FLASH and ISP/IAP support.

To setup the board for USB DFU boot mode, reset the board while holding down the ISP button.

Plug the USB cable into the USB0 connector for DFU boot.

NGX Xplorer 1830 and 4330 boards

To setup the NGX Xplorer 1830 and 4330 boards for USB DFU boot mode,

configure the DIP switch block on J4 as follows:

  • 1 - Off
  • 2 - On
  • 3 - Off
  • 4 - On

Plug the USB cable into the USB0 connector for DFU boot.

LPC-Link 2 boards : LPC4370 - No Internal Flash

To setup the LPCLink2 boards for USB DFU boot mode, make sure jumper JP1 is open.

LPCXpresso boards with the Link2 DFU boards

To setup the LPCXpresso boards with the integrated Link2 DFU interface for USB DFU boot mode, make sure jumper ;LINK DFU' is closed.

In-System Programming of LPC18xx/43xx flash

This application note provides an overview of In-System programming (ISP) and easy steps

to program the on-chip flash of LPC18xx/43xx flash based Cortex M3/Cortex M4 microcontrollers using Flash Magic software.

Keil’s MCB4300 evaluation board is used for demonstration purposes.

LPC18xx/43xx flash-based chips contain up to 1 MB flash divided into two banks:

• Bank A: 0x1A00 0000 (512 KB max.)

• Bank B: 0x1B00 0000 (512 MB max.)

In an LPC18xx/43xx with on-chip flash, USART0 or USART3 can be used for ISP communication

depending on the OTP bits and/or boot pins.

If all boot pins are held low, USART0 is selected.

In-system programming (ISP) via USART0 is used for this demo with the following pin configuration:

• P2_0 FUNCTION 1, USART0 TXD

• P2_1 FUNCTION 1, USART0 RXD

ISP mode can be entered using pin P2_7 pulled low (GND) before RESET.

LPC43xx USB DFU Notes

The LPC43xx contains USB DFU bootloader support in ROM.

By selecting the appropriate boot mode (USB0), the device will come up on USB at power-up or reset,

and implement the popular and well-documented USB DFU protocol.

Setup

Boot Mode Jumpers

Set the boot mode jumpers to USB0:

BOOT[0:3] = "1010".

Jumper setting takes effect at the next power-on or reset.

(You can rig up a reset button to P2 "LPC_JTAG" or P14 "LPC_ISP".)

USB DFU Utility

http://dfu-util.gnumonks.org/

You need the latest source from git for some reason.

Implications of Code Read Protection (CRP) on flash

Code Read Protection is the mechanism to restrict the access to on-chip flash and ISP.

The demo does not use CRP for simplicity – check ‘Asm’ tab in Target Options.

CRP is invoked by programming a specific pattern in flash at 0x2FC.

There are four different levels of CRP security defined for LPC18xx/43xx which are defined in Table 1:

LPC1800 and LPC4300 Boot/ISP/CRP的更多相关文章

  1. LPC1800 and LPC4300 MCUs

    LPC1800 Series microcontrollers At 180 MHz, LPC1800 Series microcontrollers combine the industry's f ...

  2. LPCScrypt, DFUSec : USB FLASH download, programming, and security tool, LPC-Link 2 Configuration tool, Firmware Programming

    What does this tool do? The LPC18xx/43xx DFUSec utility is a Windows PC tool that provides support f ...

  3. LPC-LINK 2

    LPC-Link 2 is an extensible, stand-alone debug adapter that can be configured to support various dev ...

  4. NXP LPC 状态可配置的定时器(SCT)

    状态可配置的定时器(SCT) 前言正在申请专利的状态可配置的定时器(SCT),是一个复杂的,但易于配置的定时器,它提供前所未有的灵活性,使工程师们在未来证明他们的设计,并减少进入市场的时间.在其最简单 ...

  5. What is OpenOCD?

    About OpenOCD was created by Dominic Rath as part of a 2005 diploma thesis written at the University ...

  6. USB with NXP Microcontrollers

    USB with NXP Microcontrollers NXP Advantages NXP's microcontroller portfolio features the latest USB ...

  7. ISP与IAP的区别

    转: ISP(In-System Programming)在系统可编程,指电路板上的空白器件可以编程写入最终用户代码, 而不需要从电路板上取下器件,已经编程的器件也可以用ISP方式擦除或再编程.IAP ...

  8. AVR单片机的BOOT区

    BOOT区的由来基于一个简单的道理,即单片机的程序是保存在FLASH中的,要运行程序就必须不停的访问FLASH存储器.对于一般的FLASH存储器,数据的写入需要一定的时间来完成,在数据写入完成之前,存 ...

  9. 痞子衡嵌入式:飞思卡尔i.MX RT系列MCU启动那些事(1)- Boot简介

    大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是飞思卡尔i.MX RT系列MCU的BootROM功能简介. 截止目前为止i.MX RT系列已公布的芯片有三款i.MXRT105x, i. ...

随机推荐

  1. 第13月第16天 ios keywindow

    1. 在弹出层弹出后keywindow已改变 http://www.jianshu.com/p/4695d7efa20b

  2. 第5月第10天 node.js的request模块

    1.node.js的request模块 http://www.cnblogs.com/meteoric_cry/archive/2012/08/18/2645530.html

  3. 【PE结构】恶意代码数字签名验证

    说明 恶意代码数字签名验证功能,WinverityTrust.CryptQueryObject 代码实现 WinVerifyTrust //------------------------------ ...

  4. MySQL 5.7在线设置复制过滤【转】

    转自 MySQL 5.7在线设置复制过滤 - yayun - 博客园 https://www.cnblogs.com/gomysql/p/4991197.html 5.7也GA了,有许多新的特性,其中 ...

  5. android蓝牙耳机下的语音(输入/识别)及按键监听

    背景:本人负责公司android平台的app开发,最近要开发一个语音助手类的app,类似于灵犀语音助手.虫洞语音助手等.其中有两个蓝牙耳机下的语音识别问题,比较折腾人,问题描述:1.蓝牙耳机连接下捕获 ...

  6. 前后端分离之mockjs基本介绍

    安装与使用 # 安装 npm install mockjs #使用 Mock var Mock = require('mockjs') var data = Mock.mock({ // 属性 lis ...

  7. Simple Web API Server in Golang (1)

    To be an better Gopher, get your hands dirty. Topcoder offered a serials of challenges for learning ...

  8. JS几种变量交换

    JS几种变量交换方式以及性能分析对比   原文 原文是自己博客上发布的JS几种变量交换方式以及性能分析对比 前言 “两个变量之间的值得交换”,这是一个经典的话题,现在也有了很多的成熟解决方案,本文主要 ...

  9. caffe之solver.prototxt文件参数设置

    caffe solver参数意义与设置 batchsize:每迭代一次,网络训练图片的数量,例如:如果你的batchsize=256,则你的网络每迭代一次,训练256张图片:则,如果你的总图片张数为1 ...

  10. vs2010添加头文件与库文件搜索目录

    1 添加头文件搜索目录 项目属性->配置属性->C/C++->常规->添加包含目录 2 添加库文件搜索 项目属性->配置属性->VC++目录->库目录