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.

TMS320F28374D: Boot second project from FLASH (switch between projects)

Part Number: TMS320F28374D
Other Parts Discussed in Thread: C2000WARE

Hello, How make switch between 2 following project located in flash:

1. I have two CCS projects : 

2. First (Project A) runs on flash application that has been loaded in sectors B,C-G. It works OK  when is  loaded by debugger;

3. Second (Project B) is defined into sectors  J-N, works OK from debugger. (It's simple application - only toggles led).

4. Project  A  knows how  to do load code of  Project B via SCI C in Extended Tektronix format  and  load this file into the flash (begins in flash J) . -After verification  its code is identical to code loaded by debugger.. 

5 . What is procedure of switching  to B project ?  Project B is need to be loaded automatically as boot instead of project A . 

6. I am looking for example . 

Thanks in advance'

AlexP

  • Hi Alex,

    You can make the switch to project B using codestart and codestartbranch

    For project B, allocate codestart to BEGIN and make sure "jump to _c_init" is available at codestart section.

    Please look for following piece of code in your linker command file.
    ______________________________________________________________
    /* BEGIN is used for the "boot to Flash" bootloader mode */

    BEGIN : origin = 0x080000, length = 0x000002

    codestart : > BEGIN PAGE = 0, ALIGN(4)
    ______________________________________________________________

    You can refer project \C2000Ware\device_support\f2837xd\examples\cpu1\blinky for reference.

    Thanks,
    Katta
  • Hi Katta,

    Thank you for your assistance ! This jump is working.

    Now I have an additional question (i'm sorry I'm new user in F2837xD ...) as follows:

    I want to load application's code without using "on-chip Bootloader". It means that app.hex (Extended Tektronix F.) file is sent byte-byte via SCIC and will be written into the flash. After that I make jump (jump to _c_init) and start new application from its flash sectors.

    This project works if new code was loaded by CCS loader which sent in app.out format(none hex), but (!), unfortunately , ("my") loading is failed when I sending this code using SCIC . Although new flash segment is identical to data from app.hex file and check sum is tested OK for each record. In additional each flash record written by my application (SCIC) is identical to record that loaded and saved using CCS loader.

    I don't understand which format: hex, out or any else need to used for loading. May be only app.out is applicable ? (how to decode .out ? maybe any library is available? )

    I prefer to get format that is easy for decoding , hex is excellent !

    I could use your help and reference to example ,

    Thanks in advance
    AlexP
  • Hi Alex,

    Good to know the jump worked.

    I am a little bit confused here. I will write about my understanding. Correct and let me know what are you looking for.

    You have Project A and project B.
    Project A is loaded via CCS.
    Project B is loaded via SCIC.
    If you restart the board project B gets executed.

    Now you want to the jump to Project B directly from Project A. Am I correct?

    "loading is failed when I sending this code using SCIC " In the above flow when did you try this?
    Did you use .hex file or .out file?

    Thanks,
    Katta
  • Hi Katta I confused you, I'm sorry !

    You understand me OK, but in fact "Project B is loaded via SCIC." - is not working, in other words : I want to load Project B using (my) SCIC channel...
    I sent app.hex file (as Extended Tektronix Format).

    Thanks Alex
  • Hi,

    Did you create the app.hex file using below command?

    hex2000.exe app.out -boot -sci8 -a -o app.hex

    Please use SCIA instead of SCIC. The SCI Kernel uses SCIA. If you want to use SCIC please make appropriate changes in the SCI Kernel code and configure the corresponding GPIO.

    Thanks,
    Katta
  • I don't want to use Kernel ! In my purpose to send hex file (maybe any other format) using SCIC - my application supports sending and placing into flash (I-N) segments .
    A question is : Now I have code (received and wrote OK) in flash . Code is identical to hex file (record-record) . Hex file is produced automatically as result of CCS link (few files including hex as follows : app.out, app.hex and app.x01) .

    Problem & Question : What I need to do with this code (located in I-N sectors - It's my new application's version for upgrading ) in purpose to run it ? - "Run" it is not question "how make jump" - you clarify it already, thanks. I ask you now, how to activate this code ?
    Or If this code that sent in pure hex format (I don't think that linker uses "t -boot -sci8 " option by default) is not applicable to run, which other format can be selected (Kernel's processing is not relevant)

    Attached here first fragment of hex file :
    //////////////////////////////////////////////
    %1262A8000800004A30 - First Record
    %4A6318000A8000FF000001FE02000000FE04000000FE0600B50AFE0800B50AFF0A00000000
    %4E62D8000A80201BF000BD3000421625001BF000BD3000421625001BF000BD3000421625001BF0
    %4E62C8000A804000BD3000421625001BF000BD3000421625001BF000BD3000421625001BF000BD
    %4E6198000A80603000421625001BF000BD3000421625001BF000BD3000421625001BF000BD3000
    %4E6258000A8080421625001BF000BD3000421625001BF000BD3000421625001BF000BD30004216
    %4E6218000A80A025001BF000BD3000421625001BF000BD3000421625001BF000BD300042162500
    %4E6378000A80C01BF000BD3000421625001BF000BD3000421625001BF000BD3000421625001BF0
    %4E6368000A80E000BD3000421625001BF000BD3000421625001BF000BD3000421625001BF000BD
    %4E6148000A81003000421625001BF000BD3000421625001BF000BD3000421625001BF000BD3000
    %4E6208000A8120421625001BF000BD3000421625001BF000BD3000421625001BF000BD30004216
    %4E61C8000A814025001BF000BD3000421625001BF000BD3000421625001BF000BD300042162500
    %4E6328000A81601BF000BD3000421625001BF000BD3000421625001BF000BD3000421625001BF0
    %4E6318000A818000BD3000421625001BF000BD3000421625001BF000BD3000421625001BF000BD
    %4E61E8000A81A03000421625001BF000BD3000421625001BF000BD3000421625001BF000BD3000
    ....
    %0E83E8000A8B30 - Last record
    ////////////////////////////////////////////////

    Thank you very much for your assistance !
  • Hi,

    "how to activate this code ? " -> When the code jump happens, project B will be executed. What do you mean by activating?

    "Or If this code that sent in pure hex format is not applicable to run"
    To check if your code is programmed correctly and can be executed without any issue please try this approach.

    Find the address of _main from Project B .map file.
    Connect to the target through CCS.
    Make the PC (Program Counter) jump to the address of _main.

    Load the symbols of Project B. Check if you could step into the code.

    Let me know if this helps.

    Thanks,
    Katta
  • Hi,

    I tested Project B. according to the following instructions (your) : 

    Find the address of _main from Project B .map file.
    Connect to the target through CCS.
    Make the PC (Program Counter) jump to the address of _main.

    Load the symbols of Project B. Check if you could step into the code.

    It doesn't work ...  , generates Illegal ISR trap

     Thx

    AlexP

  • Hi Alex,

    You mentioned you have a method to program project B in sectors (I-N). Is this method verified for any other projects where you could execute the project?

    You mentioned - "4. Project  A  knows how  to do load code of  Project B via SCI C in Extended Tektronix format  and  load this file into the flash (begins in flash J) . -After verification  its code is identical to code loaded by debugger.. "

    How did you verify the code is identical. Comparison of flash sectors data in both cases?

    It would be better to show a screenshot when you get an illegal ISR trap with the disassembly window. When do you get it? As soon as the PC starts the _main address?

    Thanks,

    Katta

  • Hello Katta,

     Thank you very much for your assistance !

    Now , I making  this screenshot and additional example to send you (based on "hex2000.exe app.out -boot -sci8 -a -o app.hex" format   that you suggested  me to use).

    Sorry , it take me some time and , in additional, we have three-day long holiday weekend in Israel. .

    I'll get back to you early next week.

    Sincerely,

    AlexP

  • Hello Katta,

    I have additional problem now :

    Flash Error , when I try to write 0 value to flash as follows:

    ///////////////////////////////////////////////////////////

    oReturnCheck = Fapi_issueProgrammingCommand((uint32 *)addr, dataword,  numWordsToFlash, 0, 0, Fapi_AutoEccGeneration);

    where : 

    addr = 0xA8002;

    Uint16 dataword = {0x0000,0x0001)   //Error if 00000 -> any other value ,for example 0x000A, 0x00001 is written OK ! 

    numWordsToFlash = 2

    /////////////////////////////////////////////////

    What I need to do in purpose write 0 to the address (0xA8002) ?

    Thx ,

    Alex P 

  • Hi Alex,

    Please refer

    10. How many bits can be programmed at a time using Fapi_issueProgrammingCommand()?

    at http://processors.wiki.ti.com/index.php/C2000_Flash_FAQ

    Have you erased the sector where you are trying to program?

    Thanks,

    Katta

  • Hi Katta'

    1.  2 words 16 bit each

    2  Yes, erased before programming

    I'm going to check FAQ - thanks for reference

    Thx,

    AlexP

  • Hi Alex,

    If it is possible please share the complete code till the line

    Fapi_issueProgrammingCommand((uint32 *)addr, dataword,  numWordsToFlash, 0, 0, Fapi_AutoEccGeneration);

    I will check if there is an issue in the sequence of the APIs.

    Thanks,

    Katta

  • Alex,

    Please check for FMSTAT value after the program operation.  See if INVDAT bit is set.

    You can use Fapi_getFsmStatus() as mentioned in the Flash API guide and shown in Flash API usage example in C2000Ware.  

    Before programming 0xA8002, if you program 0xA800 or 0xA801 using Fapi_AutoEccGeneration mode, ECC gets programmed assuming all 1s for the data that is not provided in the address range 0xA800 to 0xA803.  Hence, even though the 0x0000 that you program in main array is not colliding with any data (program of 1-> 0 or 0 -> 0 should not be an issue), ECC space may have a collision (0->1).  Please make sure to program all the 64-bits in a 64-bit aligned memory at once when using Fapi_AutoEccGeneration mode.

    Thanks and regards,
    Vamsi
     

  • Hello Vamsi,

    I solved this problem  in the following way:

    Flash0EccRegs.ECC_ENABLE.bit.ENABLE = 0x0; //because Fapi_DataOnly

    ....

    nCheck = Fapi_issueProgrammingCommand((uint32 *)addr, dataword, numWordsToFlash, 0, 0, Fapi_DataOnly); 

    It works.

    Now I back to my general problem that well  described in the following thread:

    https://e2e.ti.com/support/microcontrollers/c2000/f/171/p/807184/2997261#2997261

    In other words , my boot loader (Project A runs in sectors A-G) loads other application (Project B loaded into sectors I-N),

    And ,after that A needs to start B ... - unfortunately project B is not started ,

    Which problem (may be restart, maybe watchdog .... something else ...?) is typically occurred in this situation ?

    Do you have any example ?

    Thank you very much for your assistance,

    Alex P 

  • Hi Alex,

    As Vamsi suggested it would be better to "program all the 64-bits in a 64-bit aligned memory at once when using Fapi_AutoEccGeneration mode"

    As you are using sector I to program project B, it is not recommended in my opinion to disable the ECC. Make sure you don't enable the ECC anywhere if you are following your approach.

    Assuming Project B got programmed to Sectors I-N, could you step in using the debugger to the code where the jump to Project B occurs. Check if the jump happens.

    Thanks,

    Katta

  • Hello Katta,

    Finally, I have code of project B successfully programmed and loaded into the target. - I mean  that I pedantic tested and compared between my code (produced as result  of  activation the  project A)  and "original" code of project B that loaded by CSS debugger (project B.put) . It was compared by section-section (between my code section and CCS section).

    But the next problem has been now :

    1. Project B loaded by the CCS debugger works OK, as follows :

    - After the CPU reset it jumps to 0x3FF16A address, starts some short assembler code segment [0x3FF16A - 0x3FF224], where last instruction (0x3FF224) is branch to _c_int00 and , after that , works OK.  I don't know what does segment 0x3FF16A - 0x3FF224] (I think that it is call to BOOT ROM --?) ....

    2. Regarding to my code: 

    - I use CCS debugger which is configured to load only symbol table without programming and erasing flash; - Project B already is programmed by Project A.

    - After the CPU reset it jumps to 0x3FF16A address as well,  I found that [0x3FF16A - 0x3FF224] segment is changed as follows:

    When started my code (only sym. table):                                   [0x3FF16A - 0x3FF224]: 0xAC 0x37 0xAC 0x00 0xAD 0x42 .... (184 words)  - failed 

    When loaded original CCS code (sym. + erasing + program.)  0x3FF16A - 0x3FF224]:   0xAA 0x37 0xAC 0x00 0xAD 0x42 .... (184 words)  - succeeded

    The difference only in first byte : 0xAC <---> 0xAA .

     - If I start my code directly from _int00 (by move to line in debugger) it still not working ....

    - if I start my code without calling to InitSysCtrl() and InitGpio() then works OK !

    Therefore , I have problem to run InitSysCtrl() and InitGpio() and DELAY_US. - InitFlash() and DELAY_US run in RAM.

    - Attached below source of the Project B:

    //----------------------------------------------------------------------------------

    #include "blinkblue.h"
    #include "F28x_Project.h"

    // Variables

    Uint16 ToggleCount1 = 0;

    void blink(void)
    {
    // Initialize System Control
    InitSysCtrl();

    // Initialize GPIO
    InitGpio();
    EALLOW;
    GpioCtrlRegs.GPADIR.bit.GPIO31 = 1;
    GPIO_SetupPinOptions(34, GPIO_OUTPUT, GPIO_PUSHPULL);
    GPIO_SetupPinMux(34, GPIO_MUX_CPU1, 0); //GPIO_MUX_CPU2 original //0
    EDIS;
    GpioDataRegs.GPADAT.bit.GPIO31 = 1; // Turn off LED

    // Disable CPU interrupts and initialize PIE control registers
    DINT;
    InitPieCtrl();

    // Disable CPU interrupts and clear all CPU interrupt flags
    IER = 0x0000;
    IFR = 0x0000;

    // Initialize the PIE vector table
    InitPieVectTable();

    // Enable global interrupts and higher priority real-time debug events
    EINT; // Enable Global interrupt INTM
    ERTM; // Enable Global realtime interrupt DBGM

    // Idle loop
    for(;;)
    {
    GpioDataRegs.GPADAT.bit.GPIO31 = 0; // Turn on LD2
    DELAY_US(1000 * 500);
    GpioDataRegs.GPADAT.bit.GPIO31 = 1; // Turn off LD2
    DELAY_US(1000 * 500);
    ToggleCount1++;
    }

    //The following segment is working OK when is started directly from _cinit_00
    // int i;
    // for(;;)
    // {
    // GpioDataRegs.GPADAT.bit.GPIO31 = 0; // Turn on LD2
    //
    // for (i=0; i<900000; i++)
    // {
    // iBuf[i] = i;
    // }
    //
    // GpioDataRegs.GPADAT.bit.GPIO31 = 1; // Turn off LD2
    //
    // for (i=0; i<900000; i++)
    // {
    // iBuf[i] = i;
    // }
    //
    // ToggleCount1++;
    // }

    }// end of file------------------------------------------------------------------------------------------------

    Thank you very much for your assistance,

    Alex P 

  • Hi Alex,

    Are there any common RAM memory used between project A and B? Could you please try using dedicated RAM memory for the all linker sections except for code_start?

    Thanks,

    Katta

  • 1. No.

    I use Project A in purpose to program only ! Project A is located in sectors A-G and puts code of project B to sectors J-N in flash. After the programming is completed I exit from the project A (Power/Down-> PowerUp , reset cpu...) and I expect  that Poject B will be run... Unfortunately , it'f failed.

    In purpose to debug, I open Project B in CCS and start debug  with symbol table only  (options programming and erasing flash are closed).

    There are two independent projects in CSS : A and B. Each one compiled and linked separately . Code produced by Project B is data  that sent as text file by PC host and received by SCIC(and flashed)  in Project A.

    2. "Could you please try using dedicated RAM memory for the all linker sections except for code_start?"

    Do you have send me any example that  defines "RAM memory for the all linker section" (link cmd file, code ...) -?

    3. What is  code segment [0x3FF16A - 0x3FF224] ? ROM Boot (_BootInit, _BootExit) ? Maybe I need to disable ROM BOOT , no ?

    Thx,

    AlexP   

      

  • Hi Alex,

    Do you have send me any example that  defines "RAM memory for the all linker section" (link cmd file, code ...) -?

    You can refer to the example at C2000Ware_2_00_00_02\device_support\f2837xd\examples\dual\F2837xD_sci_flash_kernels

    We suggest to convert the blinky example at (C2000Ware_2_00_00_02\device_support\f2837xd\examples\cpu1\blinky) to .hex file to send through serial flash programmer. Kernel is programmed into RAM which inturn programs blinky application to Flash. At the end Kernel makes a jump to start of blinky application.

    If you compare the linker command files of C2000Ware_2_00_00_02\device_support\f2837xd\examples\dual\F2837xD_sci_flash_kernels\cpu01\flash_programming_cpu1tocpu2_RAM.cmd and C2000Ware_2_00_00_02\device_support\f2837xd\common\cmd\2837xD_FLASH_lnk_cpu1.cmd 

    You can observe except for .stack most of the sections such as .text, .cinit. , .pinit doesn't have common RAM sections. For ex:- kernel used RAMG0 to RAMGS6 whereas blinky application uses RAMLS3-5. 

    I suspect using a common RAM section might create a problem between project A and project B.

    Coming to your issue,

    1. Is it possible to put a breakpoint at the end of Project A just before the jump to Project B and step in using CCS. With this, you can observe Project A is jumping to Project B or not.

    2. If you just program Project B using CCS, restart the board, could you see the Project B executing? 

    3. Regarding your previous question to remove "InitSysCtrl() and InitGpio()". You will need these in Project B as you are trying to run Project B independently.

    As I cannot replicate your whole setup here, I can give suggestion. In general, we do not review or debug user code, but we will provide assistance to you with specific issues relating to our devices and development tools.  Hope you understand.

    Thanks, Katta

  • Hello Katta,

    Of cause - I understand.

    In the meantime I have a laconic question as follows :

    Can I start using debug my (already flashed) code when BOOT ROOM is disabled? 

    Sincerely,

    PS I asked u yesterday : maybe  BOOT ROM need to be disabled? :

  • Hi Alex,

    When the device is connected the PC goes to 0x3FF16A which is fine. 

    How are you going to disable the BOOT ROM?

    Do you see any issue in trying the above steps 1 & 2 I mentioned in my previous post?

    When you load the symbols of project B, you can just make the Program Counter(PC) to jump to BEGIN address i.e. 0x080000.

    "If I start my code directly from _int00 (by move to line in debugger) it still not working " 

    What does happen?

    When you load the symbols, did you try CCS -> Run -> "Go to Main" ?

    Thanks, Katta

  • Hi katta,,

    Please see my answers  as red:  

    When the device is connected the PC goes to 0x3FF16A which is fine.  - Yes when connected and after CPU reset in debug

    How are you going to disable the BOOT ROM? - I don't know I asked you ...

    Do you see any issue in trying the above steps 1 & 2 I mentioned in my previous post? Yes:

    Regarding 1. I can to jump at termination of project A to _int00  of  B ; In this case without sources and symbol table.  I go stetp by step from _int00  in direction to main of Project B (blink) in (start in sectors J) - using disassembler

    Regarding 2. The same with 1, in additional I can see sources and symbols (Debug is activated without erase and programm). Unfortunately  , If  started  from 0x3FF16A  I  not coming to _int00;  - I wiil jumped to adress 0x3ffexxx (or similar) from the way.

    If I start in address 0x3ff20d (_exitBoot of ROM BOOT) then i coming OK  to _int00 ; where chunk is :   0x3ff20d -> _int00  -> main of B and continue perform step by step up SysCtrl() and failed here .... 

    When you load the symbols of project B, you can just make the Program Counter(PC) to jump to BEGIN address i.e. 0x080000.

    Yes 0x080000 holds _int00   of project B

    "If I start my code directly from _int00 (by move to line in debugger) it still not working " 

    What does happen?  wiil jumped to adress 0x3ffexxx (or similar) from the way. but from _ExitBoot 0x3ff20d - it make steps

    When you load the symbols, did you try CCS -> Run -> "Go to Main" ? I relocate start point using disassembler

    Thanks, Katta

     Thank you very much for your assistance ,

    Alex P

  • Hi Alex,

    I think we should focus on 

    "_int00  -> main of B and continue perform step by step up SysCtrl() and failed here ...."

    Please let me know which address is used in Project A to jump to Project B. If you use 0x080000 the jump will happen to _init00.

    You wrote you can continue execution from _init00 to Main of Project B.

    Could you please step further inside SysCtrl() and see if the project fails near DELAY_US or any kind of delay function?

    As you are running the code from Flash, did you make sure ram functions copy has been made?

    i.e. Is below routine got executed in F2837xD_SysCtrl.c?

    1. memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
    2. InitFlash();

    You need not step in to check if the routine gets executed. You can see check if "_FLASH" predefined symbol is defined in project B considering you are using F2837xD_SysCtrl.c without any change.

    Thanks, Katta

  • Hi Alex,

    Please let me know which address is used in Project A to jump to Project B. If you use 0x080000 the jump will happen to _init00.  - I use  _init00 (0x00a8b2e) address,  0x80000 holds this value (0x00a8b2e)

    - Yes, I use _FLASH

    You wrote you can continue execution from _init00 to Main of Project B. - No  :

    1. Project B is was flashed with project  A , after that  A  was terminated and

    and exit debugger. Project B  is activated (stand-alone) from its CCS project by debugger - in "symbol table only" mode  - It started from     _init00 (0x00a8b2e)  and don't come to main() ....

    But I think that I detected problem as follows;In this way (init00->main) initialization of .cinit  is failed when my code is activated. The code produced by CCS works OK. What is difference ?  -

    ".cinit " data (30 length) that flashed by CCS is exactly equal to .data (30)  flashed by my program (project A). - I pedantic tested each byte. The same program works in both of cases : boot28.asm , but original code works OK and my code is going to infinite loop...

    The following fragment (of boot28.asm) illustrates  cinit initialization:

    -----------------------------------------------------------------------------

    MOVL XAR7,#cinit ; point XAR7 at start of table
    CLRC TC ; reset TC bit used as far flag
    B START, UNC ; jump to start processing
    LOOP:
    ...
    START: 
    PREAD AL,*XAR7 ; load length -------------------------------------------------->       PROBLEM : Initial value of length is 0xFFF (put to  *XAR7) - in original CCS code          ......                                                                                                                  it will be shanged (NEG AL ..) to 1; 

    B GET_ADDR,GEQ ; a length < 0 denotes far data                                        In my code it value stay be 0xFFF - XAR7 is not be changed - ?
    NEG AL ; negate value to get real length
    SETC TC ; flag that the address field is 32-bits
    ...

    ....
    BANZ LOOP,AR1-- ; if (length-- != 0) continue

    -----------------------------------------------------------------------------  

     In additional I want to remind you (we discussed this issue yesterday)  that CCS (produced code) starts after the _InitBoot(_InitExit) of ROM BOOT is completed (as termination it calls  _init00) . - My code (flashe by project A) can not be activated by _InitBoot  - so I need directly jump to _init00.

    Maybe _InitBoot locks/unlocks registers (i.g XAR7), no - ?  What settings (as alternative ROM BOOT) I need perform before activation _init00 ?

    Thank you for your assistance,

    AlexP

    Thanks, Katta

  • It started from     _init00 (0x00a8b2e)  and don't come to main() ....

    Can you manually make PC jump to 0x80000 even though it has _init00 and see if you can go up to main(). You need not step in. You can put a breakpoint at main() and see if the breakpoint is hit.

    Next time you add symbols library add symbols library of both project A and B. Do not load the symbols. Add the symbols. (Hope you know the difference. You can find the option in CCS while loading.) I want to see if the code is entering Project A or B.

    Can you share me the code how did you implement the jump to project B? I can try similar here and see if I can reproduce.

    Maybe _InitBoot locks/unlocks registers (i.g XAR7), no - ?  What settings (as alternative ROM BOOT) I need perform before activation _init00 ?

    You need to jump to code_start. It should work. Nothing is required as per my knowledge. Any how I will check with Boot ROM expert.

    Thanks, Katta

  • Hello Katta,

    I followed all recommendation and check jumps - jump to project B works OK!  Unfortunately, activation problem of project B is not solved yet. 

    So, I back to begin of the process when _c_int00 (implemented in in boot28.asm  file (rts2800_fpu32.lib ) is running.

    During debugging _cinit00 I can see one problem so clearly now . I think and believe that if we can explain why the following assembly segment doesn't work then it will be key to solution of the general (activation) problem !

    The following fragment of boot28.asm is shown twice as follows:  

    In first case, code (project B) is flashed by CSS and started by debugger (mode: load  program, erase and flash) 

    /1. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    MOVL XAR7,#cinit ; point XAR7 at start of table 
    CLRC TC ; reset TC bit used as far flag 
    B START, UNC ; jump to start processing

    LOOP: ------------------------------------------------------------------------------->    LOOP: 0a8b4a: 9B00 MOVB AH, #0x0

    .... 

    GET_ADDR: 
    MOVZ AR1,AL ; copy length value to loop register
    ADDB XAR7,#1 ; point to address field
    BANZ LOOP,AR1--  -------------------------------------------------------------->0a8b5e:   0009FFEC    BANZ         -20,AR1--

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    In this case the program works correctly -  I mean that it successfully back  from address 0x0a8b5e (AR1!=0)  to LOOP (0x0a8b4a) . In continuation, Project B works OK.

    $$$

    In the second case, code (project B) is flashed by my bootloader (project A , - after flashing it exited)  and started by debugger  in "symbol table only" mode.

    : - and here we get an ERROR - see below

    /2. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    MOVL XAR7,#cinit ; point XAR7 at start of table  ---------------------------->0a8b46:   76CA8000    MOVL         XAR7, #0x0a8000
    CLRC TC ; reset TC bit used as far flag 
    B START, UNC ; jump to start processing

    LOOP: ------------------------------------------------------------------------------->    LOOP: 0a8b4a: 9B00 MOVB AH, #0x0

    .... 

    GET_ADDR: 
    MOVZ AR1,AL ; copy length value to loop register
    ADDB XAR7,#1 ; point to address field
    BANZ LOOP,AR1--  -------------------------------------------------------------->0a8b5e:   0009FFEC    BANZ         -20,AR1--

    //////////////////////////////////////////////////////////////////////////////////

    BUG:  The program jumps from address 0x0a8b5e (AR1!=0) to address 0x0a8b46   instead of LOOP (0x0a8b4a) .

    In continuation, Project B is failed to run .

    Note, that before activation I very pedantic tested  both of sides according to few criterion's as follows:

    1. Compare two _init00  code segments : one loaded by CSS with one flashed by my boot loader  - as result they are same

    2. Compare two program's memory areas in flash : .cinit (CSS) - .cinit (my flashing) - the same  ; after that _init00 (CSS) - _init00 (my)  - the same

    3. Content of CPU registers (XARxx, PC, ...) when I run program in case 1 and run it in case 2  - check content of registers "on the fly' -  - the same

    All is same.

    What is yours opinion for branch  "BANZ LOOP,AR1-" that doesn't work in case 2 ? 

    Again, I believe  that understanding of this is key to "Project B" general problem solving .

     

    Sincerely,

    Alex P

  • Hi Alex,

    I need to loop in Boot ROM expert. Could you please post the above query in a new post?

    You can refer to this post as the original post.

    Thanks, Katta

  • Yes of cause,

    Thank you very much for your assistance