This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Codestart or C2800.init.Boot?

Other Parts Discussed in Thread: SYSBIOS, TMS320F28335

I am attempting to run an application from flash that was converted from DSP to SYS/BIOS, and have so far only maintained all legacy code.

In my linker.cmd file, there is section designation "Codestart" to "BEGIN_FLASH" at 0x33fff6, however, when I add:

var Boot = xdc.useModule('ti.catalog.c2800.init.Boot');
Boot.bootFromFlash = true;

to the cfg file, there is no designation for this.  I've read that placing this in the cfg file add the branch to c_init00 at the BEGIN section, but since mine was named BEGIN_FLASH I wasn't sure if it didn't know where to put it.  Since I only have 0x2 bits, there is only room for one of these, and since they are essentially the same thing, I don't know which one to use.

Also, if I let Codestart build without a sections defenition and try to debug the program, my ROV gives the error:

  "Target memory read failed at: 0a30d0040, langth:4 This read is at an INVALID adress according to the applications section map. The application is likely either uninitialized or corrupt."

which is confusing, because my memory map appears as the following, and I'm not sure what is causing the jump to that location.

UTPUT FILE NAME:   <Semikron_SYSBIOS.out>
ENTRY POINT SYMBOL: "_c_int00"  address: 00305452


MEMORY CONFIGURATION

         name            origin    length      used     unused   attr    fill
----------------------  --------  ---------  --------  --------  ----  --------
PAGE 0:
  L01SARAM              00008000   00002000  00001eab  00000155  RW X
  FLASH                 00300000   0003ff80  0000f2be  00030cc2  RW X
  CSM_RSVD              0033ff80   00000076  00000076  00000000  RW X
  BEGIN_FLASH           0033fff6   00000002  00000002  00000000  RW X
  PASSWORDS             0033fff8   00000008  00000008  00000000  RW X
  OTP                   00380400   00000400  00000000  00000400  RW X
  BOOTROM               003fe000   00001fc0  00000000  00001fc0  RW X

PAGE 1:
  MSARAM                00000000   00000800  00000522  000002de  RW X
  DEV_EMU               00000880   00000180  000000d0  000000b0  RWIX
  FLASH_REGS            00000a80   00000060  00000008  00000058  RWIX
  CSM                   00000ae0   00000010  00000010  00000000  RWIX
  ADC_MIRROR            00000b00   00000010  00000010  00000000  RWIX
  XINTF                 00000b20   00000020  0000001e  00000002  RWIX
  CPU_TIMER0            00000c00   00000008  00000008  00000000  RWIX
  CPU_TIMER1            00000c08   00000008  00000008  00000000  RWIX
  CPU_TIMER2            00000c10   00000008  00000008  00000000  RWIX
  PIE_CTRL              00000ce0   00000020  0000001a  00000006  RWIX
  PIEVECT               00000d00   00000100  00000000  00000100  RW X
  DMA                   00001000   00000200  000000e0  00000120  RWIX
  MCBSPA                00005000   00000040  00000025  0000001b  RWIX
  MCBSPB                00005040   00000040  00000025  0000001b  RWIX
  ECANA                 00006000   00000040  00000034  0000000c  RWIX
  ECANA_LAM             00006040   00000040  00000040  00000000  RWIX
  ECANA_MOTS            00006080   00000040  00000040  00000000  RWIX
  ECANA_MOTO            000060c0   00000040  00000040  00000000  RWIX
  ECANA_MBOX            00006100   00000100  00000100  00000000  RWIX
  ECANB                 00006200   00000040  00000034  0000000c  RWIX
  ECANB_LAM             00006240   00000040  00000040  00000000  RWIX
  ECANB_MOTS            00006280   00000040  00000040  00000000  RWIX
  ECANB_MOTO            000062c0   00000040  00000040  00000000  RWIX
  ECANB_MBOX            00006300   00000100  00000100  00000000  RWIX
  EPWM1                 00006800   00000022  00000022  00000000  RWIX
  EPWM2                 00006840   00000022  00000022  00000000  RWIX
  EPWM3                 00006880   00000022  00000022  00000000  RWIX
  EPWM4                 000068c0   00000022  00000022  00000000  RWIX
  EPWM5                 00006900   00000022  00000022  00000000  RWIX
  EPWM6                 00006940   00000022  00000022  00000000  RWIX
  ECAP1                 00006a00   00000020  00000020  00000000  RWIX
  ECAP2                 00006a20   00000020  00000020  00000000  RWIX
  ECAP3                 00006a40   00000020  00000020  00000000  RWIX
  ECAP4                 00006a60   00000020  00000020  00000000  RWIX
  ECAP5                 00006a80   00000020  00000020  00000000  RWIX
  ECAP6                 00006aa0   00000020  00000020  00000000  RWIX
  EQEP1                 00006b00   00000040  00000040  00000000  RWIX
  EQEP2                 00006b40   00000040  00000040  00000000  RWIX
  GPIOCTRL              00006f80   00000040  0000002e  00000012  RWIX
  GPIODAT               00006fc0   00000020  00000020  00000000  RWIX
  GPIOINT               00006fe0   00000020  0000000a  00000016  RWIX
  SYSTEM                00007010   00000020  00000020  00000000  RWIX
  SPIA                  00007040   00000010  00000010  00000000  RWIX
  SCIA                  00007050   00000010  00000010  00000000  RWIX
  XINTRUPT              00007070   00000010  00000010  00000000  RWIX
  ADC                   00007100   00000020  0000001e  00000002  RWIX
  SCIB                  00007750   00000010  00000010  00000000  RWIX
  SCIC                  00007770   00000010  00000010  00000000  RWIX
  I2CA                  00007900   00000040  00000022  0000001e  RWIX
  L27SARAM              0000a000   00006000  0000487a  00001786  RW X
  SRAM                  00200000   00020000  00001903  0001e6fd  RW X
  PARTID                00380090   00000001  00000001  00000000  RWIX
  CSM_PWL               003f7ff8   00000008  00000008  00000000  RWIX

 

  • Justin,

    Which device are you using?  I expected a begin address of something like 0x3F7FFE or 0x3F7FF6.

    Also, which RTSC platform are you using?  Is it “ti.platforms.tms320x28”, or something else?

    Thanks,
    Scott

  • I am using an F28335. I built a custom platform based off the EZDSP28335 and have added a few custom memory sections in the map. Here is the TCF file I used to convert it, and the Platform.xdc that was created from the conversion.

    2438.Platform.txt8623.Semikron_DCDC_v05.tcf.txt

  • Justin,

    OK, thanks for the additional info.

    When you enable the boot-to-flash option with the Boot module it will emit a long branch to the program entry point, into a memory region named “BEGIN”.  The location of BEGIN is defined as the boot-to-flash entry point in the device datasheet. 

    In the newer “generic” platform (named “ti.platforms.tms320x28”) we provide linker command files for the different supported devices, in that platform’s include subdirectory.  For example, the file ti/platforms/tms320x28/include/TMS320F28335.cmd is a starter linker command file, with this:

        BEGIN       : origin = 0x33FFF6, length = 0x000002     /* Used for "boot toFlash" bootloader mode. */

    For the older ti.platforms.ezdsp28335, the platform doesn’t provide a starter linker command file.  In the linker command file you are using, BEGIN_FLASH is at the same location, and will cause a jump to some other location.  I don’t know where that is, but it may be that it is pointing off into the weeds, causing a crash, and causing ROV to display corrupted values.   

    Can you determine what component is placing something at  BEGIN_FLASH?  (The map file shows the locations as used.)  And stop that, and then modify your linker command file to change the name to “BEGIN” instead of “BEGIN_FLASH”?  Then, hopefully the program will boot…

    Another option would be for you to switch to use the new ti.platforms.tms320x28.  I don’t know if that is an option for you, but it is the preferred platform we’ve been pointing people to.

    Hope this helps.

    Scott

  • I renamed "BEGIN_FLASH" to "BEGIN", and changed a few things, but I'm still left with the same result.

    After renaming and rebuilding, the use of :


    var Boot = xdc.useModule('ti.catalog.c2800.init.Boot');

    Boot.bootfromFlash = true;

    causes it to be place in BEGIN automatically.  This then causes a 1099-D error when the linker tries to put codestart in there. If I exlude the codestart.asm and the section declaration, the program will build, and BEGIN will have the ti.catalog.c2800.init.Boot in the BEGIN section.  This causes the ROV to still give the error that it is off in the weeds.

    If I comment out the ti.catalog.c2800.init.Boot in the cfg file, and include codestart.asm and allocate codestart to BEGIN, the program builds and the ROV gives the same exact error, pointed to the same non-existant memory location.

    If the "Boot from flash" checkbox is checked, does one normally have to comment out the allocation for codestart?

  • Justin,

    I don’t know where that codestart code is coming from.  Can you post the contents of that .asm file?

    Also, can you describe how you are booting and debugging the device?  Are you letting it boot from flash, and *then* connecting with CCS?  When CCS connects, is it possible CCS is reseting the device?

    Also, when looking at ROV, has the program at least run to main()?  ROV will look at data structures that need initialization, and can report errors if those structures have not been initialized yet.

    Also, besides what ROV indicates, is the program otherwise running?  Or is the CPU really off in the weeds?

    Thanks,
    Scott

  • 8105.CodeStartBranch.txt

    here is the CodeStart.asm file.  This was in my project from before when it was a DSP/BIOS 5 program.

    I am unsure of what different ways there are to boot and debug this device; I've always done it the same way:

    power the "ELX" pin with 35 V, 10 mS before I apply 24 V power. then just select debug in CCS. That prompts an erase and reprogram of the flash sectors and it used to always run to main() and halt.  It no longer runs to main. The debugger shows it is running, and if I halt it in the right spot (by repeatedly starting and halting it) I can stop it when it is is debuggable code, usually a SWI. If it doesn't go into debuggable code when I halt it, a mostly blank tab pops up titled "0x33ff9ce" and on the page, "no source available for '0x3ff9ce'"

    Also, looking at the disassembly, there are a lot of zeros and "ITRAP0" where BEGIN and PASSWORDS are, as shown.  I've only been able to find that this means the device is locked; is that what this symptom is?

  • Actually, I just programmed the device with the original DSP/BIOS program and it acted normally.  It ran to main() and the disassembly looks normal (I think), so maybe that's not what that meant before.

  • Justin,

    Sorry for the slow reply, I missed your response somehow.

    Thanks for the asm file.  Is the “wd_disable” in your new application, and being called somehow?  I’d guess that it is, but maybe the watchdog is going off?

    From what you describe, if CCS is loading flash as it starts up then you are really not in the flash boot mode.  Unless there is something really special happening in a GEL file that maybe resets the device after loading the flash.

    The address of 0x3FF9CE is in the boot ROM, not in the writable FLASH region.  It seems after CCS starts that it runs the CPU, something bad happens, the device gets reset, and ends up back in its bootloader.

    In CCS can you disable the automatic go to main() [right click on the project, select Properties, then Debug, then “Auto Run and Launch Options”, and uncheck the two boxes under “Auto Run Options”, then Apply, and OK], and then start the same way, and after CCS loads the program the PC should be sitting at the program entry point.  Is this address what you would expect?  Can you step the program in the debugger to see what happens from that point?

    Scott

  • After disabling the automatic run to main, the first thing that happens in the debugger is this error page:

    and the pointer is sitting at 0x305452, where c_int00 is.

    After the first step, it jumps to 0x3ff934 and allows me to step a few more times until it gets to 0x3ff9fa and stops and will not step any more.

  • OK, thanks.  So it looks like the c_int00 program entry point has nothing written by the loader.  And when you step the CPU it immediately gets vectored back into the device boot ROM.

    In your map file do you show anything being placed at 305452?

    Also, can you post a screen shot of the project’s RTSC properties page?  Right click on the project, select Properties, click General, and then the RTSC tab.

    Thanks,
    Scott

  • According to the Global Symbols list, _c_int00 is at 305452.

    Here is the RTSC properties page.

  • Hi Justin,

    So it would appear that for some reason part of the boot code isn't being programmed into flash.  Could you attach a full copy of your map file for me to look over?  We need to understand exactly why this is happening.  It could be that the linker is not linking it into the final output OR there could be a bug with flash programming.  Would you also mind looking around at the flash memory after it has been programmed to see if more of your sections are missing?

    Regards,

  • Look like your post got messed up

  • Here is my map file.  I am unsure how to look through the flash after it has been programmed>. Do you mean via the disassembly in the debug view?

  • No you can actually open a memory window from the view menu.  Its similar to the disassembly view, but there is no instruction interpretation.

    So I think I've found the problem, your linker file appears to be messed up.  If you look at the .text section in the map file you'll see that it is placed at 0x306dfe while it is linked to run from 0x301eaa.  There are a couple problems with this.  First off if you did manage to copy the section before execution it would overlap the secureRamFuncs section.  Second, you can't copy the code because you are trying to copy it to a flash location.  If you change the run address of the .text section to somewhere in RAM you should be in good shape.  The only thing to worry about would be branching to code in .text before it is copied to RAM.  Since this is boot code this is VERY likely.  The other option is to change the linker so this code simply executes from flash (by far the simplest solution if you application can handle the speed hit).

    BR,

  • Ah, that does make sense.  I'm not sure why that is the case though.  in my cfg file, i have:

    //Program.sectMap[".text"] = new Program.SectionSpec()
    Program.sectMap[".text"] = new Program.SectionSpec();
    Program.sectMap[".text"].runSegment = "FLASH";
    Program.sectMap[".text"].loadSegment = "FLASH";

    and in the generated linker.cmd there is:

    SECTIONS
    {
        .text: load >> FLASH PAGE 0, run >> FLASH PAGE 0
        .switch: load >> FLASH PAGE 0, run >> FLASH PAGE 0
        .data: load >> FLASH PAGE 0
        .cinit: load > FLASH PAGE 0, run > FLASH PAGE 0
        .bss: load > L27SARAM PAGE 1
        .ebss: load >> L27SARAM PAGE 1
        .econst: load >> FLASH PAGE 0
        .const: load >> FLASH PAGE 0, run >> SRAM PAGE 1
        .stack: load > MSARAM PAGE 1
        .sysmem: load > L27SARAM PAGE 1
        .esysmem: load > L27SARAM PAGE 1
        .pinit: load > FLASH PAGE 0, run > FLASH PAGE 0
        .args: load > L27SARAM PAGE 1 align = 0x4, fill = 0 {_argsize = 0x0; }
        .cio: load >> MSARAM PAGE 1
        .ebss:taskStackSection: load > SRAM PAGE 1
        .reset: load > MSARAM PAGE 1
        .ti_catalog_c2800_init_begin: load > BEGIN PAGE 0
        xdc.meta: load > FLASH PAGE 0, run > SRAM PAGE 1, type = COPY

    }

    and in my linker.cmd file, I added

    .text     : > FLASH, PAGE=0

    and it is still identical to before.  Is there something else that needs to be changed?

  • Nevermind, I removed the runSegment line in the cfg file and it removed the designation from the map.