AP32235 - XMC4000 - ASC Bootstrap Loader

AP32235
ASC Bootstrap loader for XMC4000
XMC4000
About this document
Scope and purpose
This application note describes how to use the ASC BSL to download the program into Flash for the XMC4000
microcontroller family. The example codes are provided with this application note to demonstrate how to
perform Flash erases, programming and Flash readback on the XMC4000 device. The applicable products are
the XMC4000 microcontroller family. The example codes are tested on the
XMC4200/XMC4400/XMC4500/XMC4800 application boards.
Intended audience
This application note is intended for a developer of Flash programming for the XMC4000 family and customers
who want to use ASC BSL to download the program into Flash.
Application Note
www.infineon.com
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
Introduction
Table of contents
Table of contents ...................................................................................................................................................2
1
1.1
1.1.1
Introduction .......................................................................................................................................3
Tool-chains .............................................................................................................................................. 3
Example Flash program ..................................................................................................................... 3
2
2.1
2.2
2.3
2.4
ASC Bootstrap loading .......................................................................................................................4
Flash loader ............................................................................................................................................. 6
DAVE™ project settings ........................................................................................................................... 6
Keil project settings................................................................................................................................. 6
Modification of startup.s file ................................................................................................................... 7
3
3.1
3.2
3.3
3.4
Flash memory organization ...............................................................................................................8
XMC4800 .................................................................................................................................................. 8
XMC4500 .................................................................................................................................................. 9
XMC4400 .................................................................................................................................................. 9
XMC4200 ................................................................................................................................................ 10
4
4.1
4.2
4.3
4.4
4.5
4.6
4.7
Communication protocol ................................................................................................................. 11
Mode 0: program Flash page ................................................................................................................. 11
Mode 1: execute user program from Flash ........................................................................................... 12
Mode 2: execute user program from iCache......................................................................................... 13
Mode 3: erase Flash sector .................................................................................................................... 13
Mode 4: read Flash protection status ................................................................................................... 13
Mode 5: protect or unprotect Flash ...................................................................................................... 14
Response code to the HOST.................................................................................................................. 14
5
HOST PC program example ............................................................................................................. 16
6
6.1
6.2
6.3
Using the demonstrator ................................................................................................................... 19
Hardware setup ..................................................................................................................................... 19
Demonstrator file structure .................................................................................................................. 19
Run the demonstrator ........................................................................................................................... 20
7
Reference documents ...................................................................................................................... 23
Revision history ................................................................................................................................................... 24
Application Note
2
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
Introduction
1
Introduction
The XMC4000 microcontroller family has a built-in Bootstrap Loader (BSL) mechanism that can be used for
Flash programming. This mechanism is described in detail in the BootROM chapter of the XMC4000 user
manual. However, the XMC4000 family of products does not provide any hard coded BSL routines in the
BootROM to carry out Flash programming, e.g. Flash writing, reading, erasing and verification. Therefore a
Flash loader program providing Flash routines must be implemented by the user.
The XMC4000 family supports both Asynchronous Serial Interface (ASC) BSL and Controller Area Network
(CAN) BSL. In this application note we will demonstrate Bootstrap loading using the ASC interface.
The target device is connected to a PC via the ASC interface. The Flash loader system demonstrated in this
application note consists of two parts:


Flash loader program
− The Flash loader program is sent to the target device using the built-in Bootstrap loading mechanism.
Once the program is sent and executed, the Flash loader program establishes a communication
protocol to receive commands from the HOST program that is running on the PC, and controls the
Flash programming of the target device.
HOST PC program
− The HOST program running on a PC uses the communication protocol defined by the Flash loader. It
sends Flash programming commands and the code bytes to be programmed. The HOST program is
application specific, so the HOST program in this application note is only an example.
1.1
Tool-chains
The Flash loader program for ASC is developed with the following tool-chains:


DAVE™ development platform v4.1.4
Keil tool-chain v.5.1
The project files for these three tool-chains provided in this example are independent from each other and
user can choose to use any of the 2.
1.1.1
Example Flash program
An example Flash program, the project LED_Blinky that toggles an LED controlled by P3.9, is provided for all
3 tool-chains. The file Blinky.hex can be downloaded to Flash memory. The XMCLoad HOST PC program is
developed with Microsoft Visual C++ 2010. The example source code is found in the following folders:





.\DAV4\XMC4x00\ASCLoader, contains the ASC BSL loader developed using the GCC compiler.
.\Keil\XMC4x00\ASCLoader, contains the ASC BSL loader developed using the Keil compiler.
.\DAV4\XMC4x00\LED_Blinky, contains the Flash example program developed using the GCC compiler.
.\Keil\XMC4x00\LED_Blinky, contains the Flash example program developed using the Keil compiler.
.\XMCLoad\, holds the example HOST PC program that demonstrates the whole process of Flash
programming. The project files can be compiled with Microsoft Visual C++2010.
Chapter 6 describes in detail how to use the demonstrator to download your own program into Flash and
run it.
Application Note
3
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
ASC Bootstrap loading
2
ASC Bootstrap loading
The communication between the PC and the target device is established via the ASC interface. Figure 1
shows a hardware setup for this application. On the target device side, channel 0 of USIC0 (U0C0) is used as
ASC. Ports P1.4 and P1.5 are used as RxD and TxD, respectively.


Receive pin RxD at pin P1.4 (USIC0_DX0B)
Transmit pin TxD at pin P1.5 (USIC0_DOUT0)
Figure 1
Connection between PC and target system for XMC4000 Bootstrap loading
To run this program, the first step is to make the target device enter ASC BSL mode.
ASC Bootstrap loader mode is entered upon a device reset, if the boot pins TMS=0 and TCK=0. These are
configured by a DIP switch on the target board.
The configuration pins TCK and TMS in XMC4000 are usually connected to a DIP switch on the XMC4000
board.
Assuming that TMS is connected to switch pin 1 and TCK connected to switch pin 2, the DIP switch
configuration is shown in Figure 2.
Figure 2
DIP switch configuration of boot modes
Application Note
4
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
ASC Bootstrap loading
The bootstrap loader procedure is shown in Figure 3.
Figure 3
ASC Bootstrap loader procedure for Flash programming
The HOST starts by transmitting a zero byte to help the device detect the baud rate. The XMC4000 device
supports baud rates of up to 115200 bits/s. The ASC interface will be initialized for 8 data bits and 1 stop bit.
After the baud rate is detected by the device, the bootstrap loader transmits an acknowledgement byte D5H
back to the host. It then waits 4 bytes, describing the length of the Flash loading program from the HOST.
The least significant byte is received first. If the application length is found to be acceptable by the BSL, an
OK (0x01H) byte is sent to the HOST, and the HOST sends the byte stream of the Flash loader. Once the byte
stream is received, the BSL terminates the protocol by sending a final OK byte and then transfers control to
the Flash loader program.
If there is an error in the application length (i.e. the application length is greater than device PSRAM size), a
N_OK byte (0x02H) is transmitted back to the HOST and the BSL resumes it’s wait for the correct length of
bytes.
The file ASCLoader.hex contains the Flash loading program. After ASCLoader is downloaded to PSRAM and
executed, it will first establish the communication between PC and the target device and then carry out
Flash operations.
Application Note
5
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
ASC Bootstrap loading
2.1
Flash loader
The Flash loader implements the Flash routines and establishes the communication between the PC and the
target device. The main part of ASCLoader (main.c) implements Flash routines providing the following
features:







Erase Flash sectors
Program Flash pages
Verify a programmed Flash page
Set flash protection
Remove flash protection
Read flash protection status
Run the codes from both Flash and iCache
The sector and page address must be specified to erase and program the Flash. An invalid address (an
address that is not within the Flash boundaries) results in an address error. The XMC4000 memory
organization is described in the Flash memory organization chapter.
Flash user codes can be executed starting from the Flash base address 0xC0000000 and the iCache base
address 0x08000000.
2.2
DAVE™ project settings
The Flash loader DAVE™ project is available in the .\DAV4\ASCLoader folder. The project can be imported
into the DAVE™ IDE with the following steps:




Open the DAVE™ IDE
Import the Infineon DAVE™ project
Select root directory as .\DAV4\ASCLoader
Finish the import
Note: The Flash loader program must be located in the PSRAM starting at 0x10000000 (XMC4500) or 0x1FFFC000
(XMC4400/4200) because the Flash loader program can only run from PSRAM. Therefore the default linker
script file generated from DAV4 cannot be used in the Flash loader project, because the default linker
script file locates the codes in iCache starting at 0x80000000. The linker script file that locates the codes
into PSRAM is provided in the XMC4x00_PSRAM.ld filer. To change the linker script file go to project
properties:


Go to Settings->ARM-GCC C Linker->General->Script file (-T)
Open “Browse…” to import the file XMC4x00_PSRAM.ld into the field
The Linker Script Language file XMC4x00_PSRAM.ld, defines the ROM memory for codes in PSRAM starting
from address 0x10000000 (XMC4500) or ox1FFFC000 (XMC4400/4200).
The stack, heap and global variables are located in DSRAM starting from address 0x20000000.
2.3
Keil project settings
The Keil project for the Flash loader is available in the folder .\Keil\ASCLoader. The Keil compiler version is
v5.1. The project can be imported into Keil µVersion as follows:


Go to project->open project
Go to folder .\Keil\Flash_Loader->choose project file “ASCLoader.uvproj”->open
Because the Flash loader must be run from PSRAM, the memory should be defined as follows:
Application Note
6
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
ASC Bootstrap loading



Go to target
IROM1 start 0x10000000 (XMC4500) or 0x1FFFC000 (XMC4400/4200), size 0x10000 (XMC4500) or 0x4000
(XMC4400/4200), Startup->yes
IRAM1 start 0x20000000, size 0x10000
By default the Keil compiler generates the object file with an ELF-format and the file extension .axf. But, the
Flash loader needs a HEX-format file. In order to get HEX file output go to:

Open Option->Output->Create HEX file
2.4
Modification of startup.s file
Attention: It is important to note that all clock setting functions in the startup_XMC4x00.s file used in all
ASCLoader projects with different compilers, must be removed so that the clock settings made in
the ASC bootstrap ROM code (firmware) can be kept without modification. For example, the
following instructions in the DAV4 startup_XMC4500.s file must be removed:


LDR R0, =SystemInit
BLX R0
These instructions must be removed because the function SystemInit() will change the clock settings, which
will change the ASC baud rate and destroy the ASC communication between the Host PC and board after
control handover from the ROM code to the downloaded Flash loader program. If the baud rate is changed,
the ASC communication between the PC and board will be broken and the Flash programming will no longer
work.
All startup.s files provided in the ASCLoader projects have been modified and the system init functions are
removed.
Application Note
7
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
Flash memory organization
3
Flash memory organization
The embedded Flash module in the XMC4x00 family includes a maximum of 1.0 MB of Flash memory for code
or constant data (called Program Flash). The PMU contains one PFLASH bank, accessible via the cacheable
or non-cacheable address space.
PFlash memory is characterized by its sector architecture and page structure. Sectors are Flash memory
partitions of different sizes. The offset address of each sector is relative to the base address of it’s bank
which is given in Table 1. Derived devices (see the XMC4000 Data Sheet) can have less Flash memory. The
PFLASH bank shrinks by cutting-off higher numbered physical sectors.
Table 1
Flash memory map
Range description
Size
Start address
PMU0 Program Flash Bank
non-cached
2 Mbyte (XMC4800)
0xC000000H
1 Mbyte (XMC4500)
512 Kbyte (XMC4400)
256 Kbyte (XMC4200)
PMU0 Program Flash Bank
cached space (different address space for the same physical
memory, mapped in the non-cached address space)
2 Mbyte (XMC4800)
0x8000000H
1 Mbyte (XMC4500)
512 Kbyte (XMC4400)
256 Kbyte (XMC4200)




Flash erasure is sector-wise.
Sectors are subdivided into pages.
Flash memory programming is page-wise.
A PFlash page contains 256 bytes.
The following table lists the logical sector structure in the XMC4x00 family of products.
3.1
XMC4800
In the XMC4800 the flash module PMU0 contains 2 MB of Pflash memory. Table 2 lists the flash logical sector
structure in XMC4800.
Table 2
Sector structure of PFLASH in XMC4500
Sector
Address range
Size
0
0xC000000-0xC003FFF
16 KB
1
0xC004000-0xC007FFF
16 KB
2
0xC008000-0xC00BFFF
16 KB
3
0xC00C000-0xC00FFFF
16 KB
4
0xC010000-0xC013FFF
16 KB
5
0xC014000-0xC017FFF
16 KB
6
0xC018000-0xC01BFFF
16 KB
7
0xC01C000-0xC01FFFF
16 KB
Application Note
8
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
Flash memory organization
Sector
Address range
Size
8
0xC020000-0xC03FFFF
128KB
9
0xC040000-0xC07FFFF
256 KB
10
0xC080000-0xC0BFFFF
256 KB
11
0xC0C0000-0xC0FFFFF
256 KB
12
0xC100000-0xC13FFFF
256 KB
13
0xC140000-0xC17FFFF
256 KB
14
0xC180000-0xC1BFFFF
256 KB
15
0xC1C0000-0xC1FFFFF
256 KB
3.2
XMC4500
In the XMC4500 the flash module PMU0 contains 1 MB of Pflash memory. Table 3 lists the flash logical sector
structure in XMC4500.
Table 3
Sector Structure of PFLASH in XMC4500
Sector
Address range
Size
0
0xC000000-0xC003FFF
16 KB
1
0xC004000-0xC007FFF
16 KB
2
0xC008000-0xC00BFFF
16 KB
3
0xC00C000-0xC00FFFF
16 KB
4
0xC010000-0xC013FFF
16 KB
5
0xC014000-0xC017FFF
16 KB
6
0xC018000-0xC01BFFF
16 KB
7
0xC01C000-0xC01FFFF
16 KB
8
0xC020000-0xC03FFFF
128KB
9
0xC040000-0xC07FFFF
256 KB
10
0xC080000-0xC0BFFFF
256 KB
11
0xC0C0000-0xC0FFFFF
256 KB
3.3
XMC4400
In the XMC4400 the flash module PMU0 contains 512 kB of Pflash memory. Table 4 lists the flash logical
sector structure in XMC4400.
Table 4
Sector structure of PFLASH in XMC4400
Sector
Address range
Size
0
0xC000000-0xC003FFF
16 KB
1
0xC004000-0xC007FFF
16 KB
2
0xC008000-0xC00BFFF
16 KB
3
0xC00C000-0xC00FFFF
16 KB
Application Note
9
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
Flash memory organization
Sector
Address range
Size
4
0xC010000-0xC013FFF
16 KB
5
0xC014000-0xC017FFF
16 KB
6
0xC018000-0xC01BFFF
16 KB
7
0xC01C000-0xC01FFFF
16 KB
8
0xC020000-0xC03FFFF
128KB
9
0xC040000-0xC07FFFF
256 KB
3.4
XMC4200
In the XMC4200 the flash module PMU0 contains 256 kB of Pflash memory. Table 5 lists the flash logical
sector structure in XMC4200.
Table 5
Sector structure of PFLASH in XMC4200
Sector
Address range
Size
0
0xC000000-0xC003FFF
16 KB
1
0xC004000-0xC007FFF
16 KB
2
0xC008000-0xC00BFFF
16 KB
3
0xC00C000-0xC00FFFF
16 KB
4
0xC010000-0xC013FFF
16 KB
5
0xC014000-0xC017FFF
16 KB
6
0xC018000-0xC01BFFF
16 KB
7
0xC01C000-0xC01FFFF
16 KB
8
0xC020000-0xC03FFFF
128KB
Application Note
10
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
Communication protocol
4
Communication protocol
The Flash loader program “ASCLoader” establishes a communication structure to receive commands from
the HOST PC.
The HOST sends commands via transfer blocks. Three types of blocks are defined:
Header block
Byte 0
Byte 1
Bytes 2…14
Byte 15
Block
Type
(0x00)
Mode
Mode-specific content
Checksum
The header block has a length of 16 bytes.
Data block
Byte 0
Byte 1
Bytes 2…257
Bytes 258…262
Byte 263
Block
Type
(0x01)
Verification
option
256 data bytes
Not used
Checksum
The data block has a length of 264 bytes.
EOT block
Byte 0
Bytes 1…14
Byte 15
Block
Type
(0x02)
Not used
Checksum
The EOT block has a length of 16 bytes.
The action required by the HOST is indicated in the Mode byte of the header block.
The Flash loader program waits to receive a valid header block and performs the corresponding action. The
correct reception of a block is judged by its checksum, which is calculated as the XOR sum of all block bytes
excluding the block type byte and the checksum byte itself.
In ASC BSL mode, all block bytes are sent at once via the UART interface. The different modes specify the
Flash routines that will be executed by the ASCLoader. The modes and their corresponding communication
protocol are described in the following sections of this chapter.
4.1
Mode 0: program Flash page
Header block
Byte 0
Byte 1
Bytes 2…5
Bytes 6…14
Byte 15
Block
Type
Mode
(0x00)
Page address
Not used
Checksum
Application Note
11
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
Communication protocol
(0x00)

Page address (32bit)
− Address of the Flash page to be programmed. The address must be 256-byte-aligned and in a valid
range (see Chapter 3), otherwise an address error will occur. Byte 2 indicates the highest byte, and
byte 5 indicates the lowest byte.
After receipt of the header block, the device sends either 0x55 as acknowledgement or an error code for an
invalid block. The loader enters a loop waiting to receive the subsequent data blocks in the format shown
below.
The loop is terminated by sending an EOT block to the target device.
Data block

Byte 0
Byte 1
Bytes 2…257
Bytes 258…262
Byte 263
Block
type
(0x01)
Verification
option
256 data bytes
Not used
Checksum
Verification option
− Set this byte to 0x01 to request a verification of the programmed page bytes.
− If set to 0x00, no verification is performed.

Code bytes
− Page content.
After each received data block, the device either sends 0x55 to the PC as acknowledgement, or it sends an
error code.
EOT block
Byte 0
Bytes 1…14
Byte 15
Block
type
(0x02)
Not used
Checksum
After each received EOT block, the device sends either 0x55 to the PC as acknowledgement, or it sends an
error code.
4.2
Mode 1: execute user program from Flash
Header block
Byte 0
Byte 1
Bytes 2…14
Byte 15
Block
type
(0x00)
Mode
(0x01)
Not Used
Checksum
Application Note
12
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
Communication protocol
The command causes a jump to the Flash base address 0xC000000. The device exits BSL mode after sending
0x55 as acknowledgement.
4.3
Mode 2: execute user program from iCache
Header block
Byte 0
Byte 1
Bytes 2…14
Byte 15
Block
type
(0x00)
Mode
(0x02)
Not used
Checksum
The command causes a jump to the iCache base address 0x8000000. The device will exit BSL mode after
sending 0x55 as acknowledgement.
4.4
Mode 3: erase Flash sector
Header block

Byte 0
Byte 1
Bytes 2…5
Bytes 6…9
Bytes 10…14
Byte 15
Block
type
(0x00)
Mode
(0x03)
Sector address
Sector size
Not used
Checksum
Sector address (32bit)
− Address of the Flash sector to be erased. The address must be a valid sector address (see Chapter 3).
Otherwise an address error will occur.
− Byte 2 indicates the highest address byte
− Byte 5 indicates the lowest address byte.

Sector size (32bit)
− Size of the Flash sector to be erased. The size must be a valid sector size (see Chapter 3).
− Byte 6 indicates the highest address byte
− Byte 9 indicates the lowest address byte.
The device sends either 0x55 to the PC as acknowledgement, or it sends an error code.
4.5
Mode 4: read Flash protection status
Header block
Byte 0
Byte 1
Bytes 2…14
Byte 15
Block
type
(0x00)
Mode
(0x04)
Not used
Checksum
− The command requires Flash protection status. The device exits BSL mode after sending 0x55 as “flash
unprotected” or 0xF8 as “flash protected”.
Application Note
13
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
Communication protocol
4.6
Mode 5: protect or unprotect Flash
Header block
Byte 0
Byte 1
Block
type
(0x00)
Mode
(0x05)
Bytes 2…5
Bytes 6…9
User
password 2
User
password 1
Bytes 10
Flash
module
Bytes 11…12 Bytes 13…14
Protection
config
Byte 15
Not used
Checksum
UserPassword1 (32bit): First user password. Byte 2 indicates the highest byte while Byte 5 indicates the
lowest byte.
UserPassword2 (32bit): Second user password. Byte 6 indicates the highest byte while Byte 9 indicates the
lowest byte.
FlashModule: reserved
ProtectionConfig (16bit): Selection of the flash sectors to be protected. The protection configuration word
has the following structure:
ProtectioConfig bit scheme
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
0
0
0
0
S11
S10
S9
S8
S7
S6
S5
S4
S3
S2
S1
S0
Sn = 0: Sector n will not be protected.
Sn = 1: Sector n will be protected.
Note: In the case that sector n does not exist, Bit Sn should be set to 0. Please refer to Chapter 3 for detailed
information about the flash sectorization.
If the Flash is unprotected, it will be protected after sending this header block. The same block sent with the
same passwords to a flash-protected device will unprotect the Flash. All erase or program commands sent
to a flash-protected device will cause a protection error.
Attention: After sending the Flash protect/unprotect command the device needs to be reset in order to make
the command valid.
4.7
Response code to the HOST
The Flash loader program will let the HOST know whether a block has been successfully received and
whether the requested Flash routine has been successfully executed by sending out a response code.
Table 6
Response codes
Response code
Description
0x55
Acknowledgement, no error
0xFF
Invalid block type
0xFE
Invalid mode
0xFD
Checksum error
Application Note
14
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
Communication protocol
Response code
Description
0xFC
Invalid address
0xFB
Error during Flash erasing
0xFA
Error during Flash programming
0xF9
Verification error
0xF8
Protection error
Application Note
15
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
HOST PC program example
5
HOST PC program example
The XMC4000_Bootloader HOST program developed in C++ uses the communication structure described in
Chapter 4.
The file XMCload_API.cpp contains the API for direct communication with the ASCLoader. The API includes
the following functions:
Table 7
API functions
API function
Description
init_uart
Initialize PC COM interface
init_ASC_BSL
Initialize ASC BSL
send_loader
Send the ASCLoader
bl_send_header
Send header block via ASC interface
bl_send_data
Send data block via ASC interface
bl_send_EOT
Send EOT block via ASC interface
bl_erase_flash
Erase PFlash sectors
bl_download_pflash
Download code to PFlash
make_flash_image
Create a Flash image from HEX file
The main program (XMCLoad.cpp) initializes ASC and sends ASCLoader to the target device.
The user must specify the HEX file to be downloaded. An example HEX file (Blinky.hex) is provided. The user
code is first downloaded to Flash and the user can then execute the downloaded code from both Flash and
iCache.


The Flash erase procedure, as shown in Figure 4 is implemented in the function bl_erase_flash().
The Flash programming procedure, as shown in Figure 5, is implemented in bl_download_pflash().
Application Note
16
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
HOST PC program example
Figure 4
Flash erase procedure implemented in bl_erase_flash()
Application Note
17
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
HOST PC program example
Figure 5
Flash programming procedure implemented in bl_download_pflash()
Application Note
18
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
Using the demonstrator
6
Using the demonstrator
The example programs have been tested on an Infineon XMC4x00 application board. The user can use the
example program to download user codes (hex file format) into Flash. Here we describe how to do that.
6.1
Hardware setup
The ASC output pin of the XMC4x00 application board gives 3.3 V, but the PC ASC output usually gives 5 V. In
order to set up the communication between the PC and the XMC4000 board through the ASC interface, a
voltage adapter (such as the Infineon Xspy-Adapter) is required to adjust the voltage difference.
If the Infineon application board with the XMC4x00 device is used in the test, the following hardware setup is
required:


Set the DIP switch jumper on board as jump 1 (ON) and jump 2 (OFF) for ASC bootstrap load mode.
Connect the VCOM interface on the application board to the PC ASC interface.
6.2
Demonstrator file structure
The following figure shows the file structure in the example programs.
Figure 6

File structure of example programs
This application note is contained in folder .\App.
Application Note
19
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
Using the demonstrator






The folders .\DAV4, .\IAR and .\Keil are the projects generated using the different compilers.
The folders \XMC4500, \XMC4400 and \XMC4200 are the device folders, where the corresponding BSL
Flash loader program is saved.
The ASCLoader project contains the ASC bootstrap loader program
The LED_Blinky project is the example project for LED blinking
.\XMCLoad contains the Microsoft Visual C++ 2010 project for the Host PC.
The ASCLoader.hex and example LED Blinky hex files are saved in.\XMCLoad\Release\XMC4x00
and.\XMCLoad\XMCLoad\XMC4x00, separately.
Attention: The VCOM on Infineon XMC4400 application board cannot be used with ASCLoader because VCOM on
XMC4400 board is NOT connected to Pins P1.4 and P1.5.
6.3
Run the demonstrator
Before starting the demonstrator, the hex file that needs to be downloaded into Flash should be copied into
the folders .\XMCLoad\Debug\XMC4x00 and .\XMCLoad\XMCLoad\XMC4x00, depending on which device is
used. For example, if the XMC4500 device is used, the hex file should be copied as:
Copy the hex file here
Figure 7
Location of object hex files to be flashed
There are two ways to start the demonstrator.
1. Double click the file XMCLoad.exe under .\XMCLoad\Release:
Application Note
20
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
Using the demonstrator
Double click to
open XMCLoader
Figure 8
Direct start of demonstrator
2. Double click the file XMCLoad.sln file in the folder .\XMCLoad to open the Microsoft Visual C++ project.
The project in this application note is developed using Microsoft Visual C++ 2010.
Double click to
open Microsoft
Visual C++ project
Figure 9
Start of demonstrator using Microsoft Visual C++ project
Application Note
21
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
Using the demonstrator
In Microsoft Visual project workbench the project can be started from the “F5” key.
On starting the demonstrator the following window is displayed:
Figure 10
Start using Microsoft Visual project
Follow the instructions in the window to finish the Flash programming, set Flash protection or remove the
Flash protection.
Note: The hex file name that will be programmed into Flash must be given completely with the file extension;
e.g. Blinky.hex. Otherwise, the program does not know the file name. The Flash loader program accepts
only hex file format. Furthermore, the ACLoader.hex is less than 4096 Bytes, so the 4 bytes Application
Length should be given with 4096.
After the hex file is programmed into Flash, the program can be executed from both Flash and iCache.
Application Note
22
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
Reference documents
7
Table 8
Reference documents
References
Document
Description
Location
XMC4000 User’s Manual
User’s Manual for XMC4000
device
http://www.infineon.com/XMC4000
Application Note
23
Revision 1.3
2016-03-01
ASC Bootstrap loader for XMC4000
XMC4000
Revision history
Revision history
Current Version is 3, 2016-03-01
Page or Reference
Description of change
V1.0, 2013-10
Initial Version
V1.2, 2015-05
1.
2.
3.
4.
Changing the format
Adding workaround for Segger VCOM issue in example codes
Changing DAVE3 example projects to DAVE4
Adding Flash protection commands
V1.3, 2015-11
1. Adding XMC4800 support
Application Note
24
Revision 1.3
2016-03-01
Trademarks of Infineon Technologies AG
AURIX™, C166™, CanPAK™, CIPOS™, CoolGaN™, CoolMOS™, CoolSET™, CoolSiC™, CORECONTROL™, CROSSAVE™, DAVE™, DI-POL™, DrBlade™, EasyPIM™,
EconoBRIDGE™, EconoDUAL™, EconoPACK™, EconoPIM™, EiceDRIVER™, eupec™, FCOS™, HITFET™, HybridPACK™, Infineon™, ISOFACE™, IsoPACK™,
i-Wafer™, MIPAQ™, ModSTACK™, my-d™, NovalithIC™, OmniTune™, OPTIGA™, OptiMOS™, ORIGA™, POWERCODE™, PRIMARION™, PrimePACK™,
PrimeSTACK™, PROFET™, PRO-SIL™, RASIC™, REAL3™, ReverSave™, SatRIC™, SIEGET™, SIPMOS™, SmartLEWIS™, SOLID FLASH™, SPOC™, TEMPFET™,
thinQ!™, TRENCHSTOP™, TriCore™.
Trademarks updated August 2015
Other Trademarks
All referenced product or service names and trademarks are the property of their respective owners.
Edition 2016-03-01
Published by
Infineon Technologies AG
81726 Munich, Germany
©ifx1owners.
2016 Infineon Technologies AG.
All Rights Reserved.
Do you have a question about this
document?
Email: [email protected]
Document reference
AP32235
IMPORTANT NOTICE
The information contained in this application note
is given as a hint for the implementation of the
product only and shall in no event be regarded as a
description or warranty of a certain functionality,
condition or quality of the product. Before
implementation of the product, the recipient of this
application note must verify any function and other
technical information given herein in the real
application.
Infineon
Technologies
hereby
disclaims any and all warranties and liabilities of
any kind (including without limitation warranties of
non-infringement of intellectual property rights of
any third party) with respect to any and all
information given in this application note.
The data contained in this document is exclusively
intended for technically trained staff. It is the
responsibility of customer’s technical departments
to evaluate the suitability of the product for the
intended application and the completeness of the
product information given in this document with
respect to such application.
For further information on the product, technology,
delivery terms and conditions and prices please
contact your nearest Infineon Technologies office
(www.infineon.com).
WARNINGS
Due to technical requirements products may
contain dangerous substances. For information on
the types in question please contact your nearest
Infineon Technologies office.
Except as otherwise explicitly approved by Infineon
Technologies in a written document signed by
authorized
representatives
of
Infineon
Technologies, Infineon Technologies’ products may
not be used in any applications where a failure of
the product or any consequences of the use thereof
can reasonably be expected to result in personal
injury.