[SOLVED] OpenFlashLoader ARM926EJ-S and NAND flash

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • OpenFlashLoader ARM926EJ-S and NAND flash

    I have several question about OpenFlashLoader

    1. I created FLM file for my MCU in KEIL and add my device in JLinkDevices.xml. J-Flash succesfully connect to my MCU.
    But when I try to perfrom any operation I see:

    - ERROR: Can not read register 0 (R0) while CPU is running
    Can not read register 1 (R1) while CPU is running
    Can not read register 2 (R2) while CPU is running
    Can not read register 3 (R3) while CPU is running
    Can not read register 4 (R4) while CPU is running
    Can not read register 5 (R5) while CPU is running
    Can not read register 6 (R6) while CPU is running
    Can not read register 7 (R7) while CPU is running
    Can not read register 10 (R8_USR) while CPU is running
    Can not read register 11 (R9_USR) while CPU is running
    Can not read register 12 (R10_USR) while CPU is running
    Can not read register 13 (R11_USR) while CPU is running
    Can not read register 14 (R12_USR) while CPU is running
    Can not read register 15 (R13_USR) while CPU is running
    Can not read register 16 (R14_USR) while CPU is running
    Can not read register 9 (R15 (PC)) while CPU is running
    Can not read register 8 (CPSR) while CPU is running
    Can not read register 30 (R14_ABT) while CPU is running
    Can not read register 28 (SPSR_ABT) while CPU is running

    2. In KEIL project we don't use startup file, it means we didn't initialize stack of MCU. It mean we can't use local variables and fucntions calls inside openflashloader functions?
    No calls from:
    int Init(U32 Addr, U32 Freq, U32 Func)
    int UnInit(U32 Func)int SEGGER_OPEN_Erase(U32 SectorAddr, U32 SectorIndex, U32 NumSectors)and other functionsThanks in advance!
  • [SOLVED] OpenFlashLoader ARM926EJ-S and NAND flash

    Hello,

    You need to distinguish between 2 builds for your flash loader:
    1) Debug
    The debug build should have a startup etc. so that you initialize SP etc. and are able to debug your flash loader.


    2) Release
    The release build should not rely on any startup code.
    The ELF / AXF file from the release build is downloaded by J-Link into RAM and then the PC is set to the different functions to execute Init() UnInit() ...
    J-Link will setup the SP before starting execution of the functions it has set the PC to.

    From your output it looks like something more basic is not working.
    Unfortunately, the output you have send does not say much expect from that J-Link seems to be unable to halt the CPU.
  • I'm moving forward, but still have no luck.

    My device described as

    C Source Code

    1. struct FlashDevice const FlashDevice __attribute__((used)) __attribute__ ((section ("DevDscr"))) = {
    2. ALGO_VERSION, // Algo version
    3. "NAND FM60 in keil", // Flash device name
    4. ONCHIP, // Flash device type
    5. 0x00000000, // Flash base address
    6. 0x08000000, // Total flash device size in Bytes (128 MB)
    7. 0x800, // Page Size (number of bytes that will be passed to ProgramPage(). May be multiple of min alignment in order to reduce overhead for calling ProgramPage multiple times
    8. 0, // Reserved, should be 0
    9. 0xFF, // Flash erased value
    10. 100, // Program page timeout in ms
    11. 6000, // Erase sector timeout in ms
    12. //
    13. // Flash sector layout definition
    14. //
    15. 0x00000800, 0x00000000, //
    16. 0xFFFFFFFF, 0xFFFFFFFF // Indicates the end of the flash sector layout. Must be present.
    17. };
    Display All
    you can see page size is set as 0x800. But when I press connect in J-Flash I see message like on attached picture. Why it happens?
    Images
    • 2.png

      4.89 kB, 367×147, viewed 54 times
  • Hello,

    The best place for PLL init etc. is in the Init() function of your RAMCode.
    Can you please check with the latest version of J-Flash?
    You are using V6.14f which is from year 2017. Since then, there have been multiple improvements and bugfixes reg. open flash loader.


    BR
    Alex