Valentin Gruia

BDM - flash programmer failure

Discussion created by Valentin Gruia on Oct 24, 2011
Latest reply on Oct 25, 2011 by Valentin Gruia



I have a very basic problem. I write a small application in a sooper loop maner, for coldfire MCF52255 using CW10. After I test the code in debug mode, using USB TapBDM, I try to install the code using Flash Programmer. I downloaded succesfuly code on the target but the application refuse to start.


There is the last part of the programmer’s report:


Downloading 0x00000418 bytes to be programmed at 0x00000000  

 Programming ....

 Program Command Succeeded   

Downloading 0x00001080 bytes to be programmed at 0x00000500  

 Programming ....

 Program Command Succeeded   



Verifying file D:\PrjEW_MonoBoard\Firmware_mod\MonoBoard\MCF52255_Release\MonoBoard.elf  

Auto-detection is successful.  

  File is of type Elf Format.  


Reading 0x00000418 bytes starting from address 0x00000000  

Reading 0x00001080 bytes starting from address 0x00000500  

Verify Command Succeeded


I suspected that some registres that are not initialised correctly. I think that in debug mode the bootloader make all the setting so my application can run properly.


The next step was to test as low level as posible the CPU running path. So in startup file, after the first settings I inserted one function that will toggle one led (located on PORTTI bit0).  The code refuse to execute this function eather.


Here is the _startup() function


asm __declspec(register_abi) void _startup(void)


      /* disable interrupts */

    move.w        #0x2700,sr


      /* Pre-init SP    */

      lea __SP_AFTER_RESET,a7;


    /* initialize memory */



     /* initialize any hardware specific issues */

    /* ISPBAR, FLASHBAR, pll, SCM, exceptions */

    jsr         __initialize_hardware  


    /* this function will block the program and will blink the LED */

    jsr           signal_led_run

      …     /* other code - never arrive here*/



The function that toggle the led is implemented in ASM:


asm __declspec(register_abi) void signal_led_run(void)


      move.b  #0xff,d0

      move.b  d0,0x4010001C         /* DDRTI  output*/




      move.b #0x01, d0

      move.b d0, 0x40100034         /* SETTI */





      move.b #0x00, d0

      move.b d0, 0x4010004C         /* CLRTI */

      bra __loop_led_run            /* loop back */







I want to know if anybody had similar problems.

What may be the reason for such behaviour?


This code is very basic, can someone confirm that in this stage of initialization the controller can access external ports?