µC/FL Ports

Overview

Benefits

Updater

Licensing

Pricing Information

General porting guidelines

Available ports

Mitsubishi M16C

Mitsubishi M32C

Atmel ARM AT91M40800

Philips ARM LPC2XXX

ATMEL ATmega128

General porting guidelines

The only thing you have to do is to adapt the CPU and the UART-module located in the PORT-folder. When starting the bootloader (BTL) the right processor mode has to be configured, a timer has to be started and the UART communication has to be enabled. The following information explains the functions called by the BTL.

CPU related functions, CPU.c
Function
Description
CPU_Exit()

This routine has to set all special function registers modified in the CPU module (in CPU_Init(), CPU_Poll() or CPU_StartApplication()) back to their initial state after reset. This is necessary, because the application program expects all sfrs to be in the state documented as “after RESET”.

CPU_GetName()

This routine has to return a pointer to the CPU-name. It would be shown by µC/FlashLoader in the target description.

CPU_Init()

This routine has to make sure the right processor mode has been selected, the clock mode has to be configured properly and a timer has been started. The timer would be used by CPU_Poll to notice if a millisecond has been passed.

CPU_Poll()

This routine is called regularly from the main loop of the BTL. It is used as time base for the BTL and has to notice if a millisecond has been elapsed. The time is used to determine when the communication to the PC is timed out and the application has to be started. There are two options:

  • Precise timing using a hardware timer.
  • Simple timing using a counter.
CPU_StartApplication()

This routine would be called to start the application program program. It is called under 2 circumstances:

  • If the timeout time (BTL_WAIT0_MS, configured in BTLConf.h), has expired, no communication request from the PC has been detected and a valid application program has been programmed into the target.
  • If the user chooses “Start Program” from the target menu from µC/FlashLoader.

In dependence of the way of starting the CPU (using a reset vector or starting at a fixed address) the function should

  • either jump to the address pointed by the reset vector of the application program (if using a reset vector)
  • or jump to a fixed address, typically the start address plus the size of the BTL bank (if using a fixed address)


UART related functions, UART.c

Function
Description
UART_Exit()

This routine has to set all special function registers modified in the UART module (in UART_Init(), UART_Poll() or UART_Send1()) back to their initial state after reset. This is necessary, because the application program expects all sfrs to be in the state documented as “after RESET”. Before doing so, this routine needs to make sure that all bytes which should have been transmitted (by calling UART_Send1) have already been sent. Do not deinitialize the UART before the last byte has been transmitted!

UART_Init()

This routine has to enable the UART communication. It should be useful if the configuration macros of BTLConf.h would be used to configure the communication:

  • BAUDRATE - Baud rate to communicate
  • UARTSEL - Used to select the UART
  • UPCLOCK - CPU frequency

Communication parameters:

  • 8 data bits
  • Odd parity
  • 1 stop bit
UART_Poll()

This routine has to return if a character has been received.

UART_Send1()

This routine has to send 1 character. Before sending the character is has to make sure the output buffer has been transmitted.

If the macros ENABLE_TRANSMITTER() and DISABLE_TRANSMITTER() are used, ensure that this function does not return until the complete byte has been sent.

FLASH related functions, FLASH.c

If you need to manage CPU internal flash memory you have to include the empty flash driver FLASH.c to your project and to adapt the functions to your flash.

Function
Description
FLASH_EraseSector()

This routine has to erase all sectors of the CPU internal flash.

FLASH_GetNumSectors()

Returns the number of physical flash sectors.

FLASH_WriteAdr()

This routine has to write the given array into the flash.

User functions, USER.c

The functions located in this module have no functionality by default. They can be used for additional initialization or other purposes.

Function
Description
USER_Init()

This routine is called after CPU_Init(). A typical use of this function could be additional hardware initialization.

USER_Exit()

This routine is called before the application program will be started. This routine can be used to restore the reset values to the registers used in USER_Init().

USER_Poll()

This routine is called after CPU_Poll().


Available ports

The table below lists all currently available ports.

Port Supported CPU's
Generic Should be adapted to a desired target

78K4_IAR

NEC 78K4

ARM_AT91M40800_IAR

Arm AT91M40800

ARM_AT91M55800_IAR

Arm AT91M55800

M16C20_IAR

Renesas M30201F6

M16C60_IAR

(please take a look to the subchapter M16C)

M16C60_NC30

(please take a look to the subchapter M16C)

M16C60_TASKING

(please take a look to the subchapter M16C)

M16C80_IAR

Renesas M30800FCFP, M30800FCGP,
M30803FGFP, M30803FGGP

M16C80_NC308

Renesas M30800FCFP, M30800FCGP,
M30803FGFP, M30803FGGP

M32C_IAR

Renesas M30835FJGP, M30833FJGP,
M30833FJFP

MIPS_VR4181A_GHSM2K

VR4181A

V850SA1_GHSM2K

NEC µPD70F3017A

V850SA2_IAR

NEC µPD70F3201, µPD70F3201Y

V850SF1_GHSM2K

NEC µPD70F3079Y

The following sections describe some of the Flash Loader ports currently available in detail. If the CPU of the target system you are interested in is not listed here, please contact us. We can provide you with some sample code even if the CPU is not listed here.

Mitsubishi M16C

Supported CPU's

M30280F6HP,

M30280F6THP, M30280F6VHP, M30280F8HP,
M30280F8THP, M30280F8VHP, M30280FAHP, M30280FATHP,
M30280FAVHP, M30281F6HP, M30281F6THP, M30281F6VHP,
M30281F8HP, M30281F8THP, M30281F8VHP, M30281FAHP,
M30281FATHP, M30281FAVHP, M30290F8HP, M30290F8THP
M30290F8VHP, M30290FAHP M30290FATHP, M30290FAVHP
M30290FCHP, M30290FCTHP , M30290FCVHP, M30291F8HP
M30291F8THP, M30291F8VHP, M30291FAHP, M30291FATHP
M30291FAVHP, M30291FCHP, M30291FCTHP, M30291FCVHP
M30622F8PFP, M30622F8PGP, M30620FCPFP, M30620FCPGP,
M30624FGPFP, M30624FGPGP, M30625FGPGP, M30626FHPFP,
M30626FHPGP, M30627FHPGP, M30626FJPFP, M30626FJPGP,
M30627FJPGP, M30620FCAFP, M30620FCAGP, M30620FCMFP,
M30620FCMGP, M30620FGFP, M30620FGGP, M30620FGLFP,
M30620FGLGP, M30624FGAFP, M30624FGAGP, M30624FGFP,
M30624FGGP, M30624FGMFP, M30624FGMGP, M30624FGLFP,
M30624FGLGP, M30625FGGP, M30625FGLGP, M306NBFCTFP,
M306N0FGTFP, M306NAFGTFP, M3062GF8NFP, M3062GF8NGP,
M30620FCNFP, M30620FCNGP, M30624FCNFP, M30624FCNGP,
M30624FGNFP, M30624FGNGP, M30624FGNHP, M306N4FCTFP,
M306N4FCVFP, M306N5FCTFP, M306N5FCVFP, M306N4FGTFP,
M306N4FGVFP, M30262F6GP, M30262F8GP  

Memory map

Note 1: The addresses X1-X3 depend on the target CPU. The BTL needs 8K of ROM and is located at 0xFE000-0xFFFFF. If using a target with a 16K sector at the end of the flash, the address X1 is 0xFC000. If using a target with a 8K sector or 2 4K sectors at the end, the address X1 is 0xFE000. The address X2 can be calculated as follows: X2 = X1 – 0x10. The address X3 can be calculated as follows: X3 = X1 – 0x34.

Note 2: The beginning of the user area depends on the target. The address X4 is typically the first address of the flash area, for example 0xFC000 for a target with 256K of flash memory.

The BTL resides in the top bank of CPUs internal FLASH. Unfortunately this bank is 8 or 16kb in size (the BTL uses only approx. 5kb), but you loose the en-tire bank(s) for your application program. Since the RESET vector is located in this bank, the BTL is automatically started after RESET. The RESET vector of the application program is moved down in memory by 0x4010 or 0x2010 bytes depending on your target CPU. The application pro-gram can be compiled and linked the same way as without BTL; you only have to change the memory locations in the XCL-file as shown below.

Mitsubishi M32C

Supported CPU's

M30835FJGP,

M30833FJGP, M30833FJFP, M30853FHFP,
M30853FHGP, M30853FHTGP, M30853FJFP, M30853FJGP,
M30853FJTGP, M30853FWFP, M30853FWGP, M30853FWTGP,
M30855FHGP, M30855FHTGP, M30855FJGP, M30855FJTGP,
M30855FWGP, M30855FWTGP    

Memory map

Note 1: The addresses X1-X3 depend on the target CPU. The BTL needs 4K of ROM and is located at 0xFFF000-0xFFFFFF. If using a target with a 16K sector at the end of the flash, the address X1 is 0xFFC000. If using a target with a 4K sector at the end, the address X1 is 0xFFF000. The address X2 can be calculated as follows: X2 = X1 – 0x10. The address X3 can be calculated as follows: X3 = X1 – 0x34.

Note 2: The beginning of the user area depends on the target. The address X4 is typically the first address of the flash area, for example 0xF80000 for a target with 512K of flash memory.

The BTL resides in the top bank of CPUs internal FLASH. Since the RESET vector is located in this bank, the BTL is automatically started after RESET. The RESET vector of the application program is moved down in memory by 0x4010 or 0x1010 bytes depending on your target CPU. The application pro-gram can be compiled and linked the same way as without BTL; you only have to change the memory locations in the XCL-file.

Atmel ARM AT91M40800

Memory map

The project contains 3 targets:

RAM_BTL
This target is used to run the BTL in RAM using a wiggler. Use the RAM_BTL to program the RELEASE_BTL into the external flash.

RELEASE_BTL
The release target.

KILL_BTL
This target can be used to program a new release version of the BTL into the external flash without using a wiggler.

Philips ARM LPC2XXX

Supported CPU's

LPC2104

LPC2105 LPC2106 LPC2114
LPC2119 LPC2124 LPC2129 LPC2131
LPC2132 LPC2134 LPC2136 LPC2138
LPC2194 LPC2212 LPC2214 LPC2292
LPC2294      

Memory map

The BTL resides in the bottom sector(s) of CPUs internal FLASH. Since the RESET vector is located in this bank, the BTL is automatically started after RESET.

The application program is moved up in memory by 0x2000 bytes. The applica-tion program can be compiled and linked the same way as without BTL; you only have to change the memory location.
The BTL data area resides at the top of the application sectors.

ATMEL ATmega128

Memory map