Skip to main content
Visitor II
June 21, 2004
Question

boot and main flash?

  • June 21, 2004
  • 3 replies
  • 970 views
Posted on June 21, 2004 at 09:24

boot and main flash?

    This topic has been closed for replies.

    3 replies

    hpaskalAuthor
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 12:01

    Hi !

    I am using upsd3334d device with KEIL uVision2.

    My bootloader project configs:

    fs0: 0x0000 - 0x3FFF

    fs1: 0x8000 - 0xFFFF page 1

    fs2: 0x8000 - 0xFFFF page 2

    ...

    fs7: 0x8000 - 0xFFFF page 7

    rs0: 0x4000 - 0x5FFF

    csiop: 0x6000 - 0x60FF

    csboot0: 0x0000 - 0x1FFF

    during the boot , the main flash is in Data space.

    i wrote a boot code that runs on csboot0 and seems to wroke fine exept 2 problems:

    1)I am using Flashcode.c file from the ST boot examples.

    befor I program the main flash , I erased it with the erase function :

    flash_erase_sector(0x0000);

    for(page=1;page<=NumHexFiles;page++)

    {

    page_set(page);

    flash_erase_sector(0x8000);

    }

    .

    If this code is running after I burn the boot project with jtag , it is ok.

    BUT if i try to run it not after a jtag burn, i stuck in the flash_erase_sector()

    function.

    what could be the problem ?

    2)problem NO.2:

    when i finish to wrote the main flash , I set the VM reg and need to jump to address 0.

    if I stop and set the PC manually to 0 , i can see that it is OK and the new code is running ok.

    but when the program trys to jump to loacation 0 , it dont work.

    here is the jump routine :

    void

    SwitchMainFlash()

    {

    PSD8xx_reg.VM = 0x8C;

    PSD8xx_reg.PAGE=0;

    #pragma asm

    ljmp 0x0000;

    #pragma endasm

    }

    What can be the problem ?

    Thanks

    [ This message was edited by: hpaskal on 20-06-2004 18:33 ]
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 12:01

    hi haim

    In problem 2 try

    SwitchMainFlash()

    {

    PSD8xx_reg.VM = 0x0C;

    #pragma asm

    jmp 0x0000;

    #pragma endasm

    }

    try jmp insate of ljmp

    In my project, I do the same and It''s work fine.

    Did you put SwitchMainFlash in fixed address. if not put the line

    ?PR?SwitchMainFlash?ModulName(fixed address)

    in BL51 locate in the line code.

    the SwitchMainFlash procedure must be the only procedure in ModulName .

    hanan

    [ This message was edited by: hanan54 on 21-06-2004 08:44 ]
    hpaskalAuthor
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 12:01

    Thank u very much hanan54 and HansDK!

    it works .

    this make sence cause u cant switch to main flash and expect to fetch another command from the second flash ...!

    I still have the erase problem

    can anyone help ?

    [ This message was edited by: hpaskal on 21-06-2004 12:59 ]