Author Topic: Boot loader for program bigger than 128 Kb - Initialization of the main program  (Read 6951 times)

Offline Gonzalo

  • Newbie
  • *
  • Posts: 1
    • View Profile
Hi,

I'm using mcv5223X board. I want to program a bootloader (BL) for update the main code. I saw the bare minimum boot loader, but this code accepts programs up to 128 kb, but i need upload bigger programs. The idea is to program a BL that runs after the reset and check a TCP/IP comand. If the comand is the correct, the program will recive the code (in parts) and then flash it to de asignated space (in parts too). When the upload finishes, the BL will check the program is ok and then jump to it.
If the BL doesn´t recive the comand, it will check the program and then will jump to the program.

I saw in the bare minimun bootloader (uTaskerBootV1.4_CW7) that in file mcf5223X_boot.s after calling uTaskerBoot apears that:

    move.l  #0x00000800,a0   
    move.l  (a0),sp
    move.l  #0x00000804,a0
    move.l  (a0),a0               /* use for standard boot loader from internal FLASH */
    jmp (a0)                      /* jump to the main program */

I suppose that the main program start in the address 0x804. Here I have a question, when I program the main application how can I define the address where de main sub is flashed?

The second question is how to initilizate the Exception Vector Table in the main application: The default lcf file defines vectorrom   (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400. And in the position 0x004 calls the _starup. So i can't erase modify this page to avoid problems.

thanks for all

Gonzalo

PD: sorry about my bad english



Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Hi Gonzalo

First you need to identify whether the "bare-minimum" boot loader is the most suitable for your work. It is small (about 2k in size) but can't actually load any code of its own. This would mean that the details about detecting new code and loading it needs to be performed by your first application. Also the code needs to be copied to an intermediate location before the boot loader exchances the old application with the new one.

An alternative is to use the uTasker project as boot loader to a second application. In this case it occupies more space but can make use of its rosources to perform more complex loading with out the need for application suppport. In this case it can also directly load the application to its application space.

To your specific questions:
1) The uTasker project contains targets for working with the boot loader. If you look at the linker script files used you will see that the start location of teh application is simply moved from 0x00000000 to the new start address.

2) The boot loader defines the reset and vector table and also the FLASH configuration. The application doesn't need these (just the reset vector at the new start address). The application must therefore also position its interrupt vectors in SRAM sine it is not possible to work with the vector table in FLASH since it is occupied by the boot loader. Most Coldfire projects work with vectors in SRAM since it is generally more flexible.

Regards

Mark