Bootloader Flashing issue

I am working on F1KM-S1 controller.

I am using bootloader to flash the code.

While connecting debugger and bootloader flashing at the same time, it's working. 

But when mcu in standalone, the FCL operations like erase /Flash are not happening.

The additional details are ,

;-----------------------------------------------------------------------------
; hdwinit
; Specify RAM addresses suitable to your system if needed.
;-----------------------------------------------------------------------------
GLOBAL_RAM_ADDR .set 0
GLOBAL_RAM_END .set 0
LOCAL_RAM_ADDR .set 0xfede0000
LOCAL_RAM_END .set 0xfedf7fff

.align 2
_hdwinit:
mov lp, r14 ; save return address

; clear Global RAM
mov GLOBAL_RAM_ADDR, r6
mov GLOBAL_RAM_END, r7
jarl _zeroclr4, lp

; clear Local RAM
mov LOCAL_RAM_ADDR, r6
mov LOCAL_RAM_END, r7
jarl _zeroclr4, lp

mov r14, lp
jmp [lp]

;-----------------------------------------------------------------------------
; zeroclr4
;-----------------------------------------------------------------------------
.align 2
_zeroclr4:
br .L.zeroclr4.2
.L.zeroclr4.1:
st.w r0, [r6]
add 4, r6
.L.zeroclr4.2:
cmp r6, r7
bh .L.zeroclr4.1
jmp [lp]

  Kindly support on this issue

  • Hello,

    It could be because the program accesses uninitialized parts of RAM and this results in ECC errors. When running without debugger connected, RAM is not automatically initialized and it is recommended to do it manually. Please check this article on how to do it following the code example:

    en-support.renesas.com/.../19957725

  • Thanks for the Reply,

    I relatively understood that Program uses the uninitialized  area for fetching data . As it is mentioned in the document, the RAM to be initialized before main function. It was already done in boot.asm which is given below ,

    ;-----------------------------------------------------------------------------
    ; hdwinit
    ; Specify RAM addresses suitable to your system if needed.
    ;-----------------------------------------------------------------------------
    GLOBAL_RAM_ADDR .set 0
    GLOBAL_RAM_END .set 0
    LOCAL_RAM_ADDR .set 0xfede0000
    LOCAL_RAM_END .set 0xfedf7fff

    .align 2
    _hdwinit:
    mov lp, r14 ; save return address

    ; clear Global RAM
    mov GLOBAL_RAM_ADDR, r6
    mov GLOBAL_RAM_END, r7
    jarl _zeroclr4, lp

    ; clear Local RAM
    mov LOCAL_RAM_ADDR, r6
    mov LOCAL_RAM_END, r7
    jarl _zeroclr4, lp

    mov r14, lp
    jmp [lp]

    ;-----------------------------------------------------------------------------
    ; zeroclr4
    ;-----------------------------------------------------------------------------
    .align 2
    _zeroclr4:
    br .L.zeroclr4.2
    .L.zeroclr4.1:
    st.w r0, [r6]
    add 4, r6
    .L.zeroclr4.2:
    cmp r6, r7
    bh .L.zeroclr4.1
    jmp [lp]  

    FDL library is accessing correctly in standalone, only FCL library functions are not working. I have added the section address details .

  • Only FCL Library is not working. Remaining all other functions are working.

  • Please try to initialize both the self and CPU local RAM area:

  • Hi,

    I have tried the below code to initialize the RAM in boot.asm file. But still, the erase and writing operation is not working in standalone board and the error was R_FCL_ERR_FLOW during erase operation. With the debugger its working fine. I am totally out of mind, by trying numerous ways . The stack size is 0x200 in cstart.asm file, Any other suggestions please

     STACKSIZE .set 0x200
    .section ".stack.bss", bss
    .align 4
    .ds (STACKSIZE)
    .align 4
    _stacktop:

    The RAM initialization in boot.asm

    ;-----------------------------------------------------------------------------
    ; Specify RAM addresses for CPU Local RAM, Self Local RAM, and Retention RAM
    ;-----------------------------------------------------------------------------
    GLOBAL_RAM_ADDR .set 0
    GLOBAL_RAM_END .set 0

    CPU_LOCAL_RAM_ADDR .set 0xfebe0000 ; CPU Local RAM Start
    CPU_LOCAL_RAM_END .set 0xfebf7fff ; CPU Local RAM End

    CPU_RET_RAM_ADDR .set 0xfebf8000 ; CPU Retention RAM Start
    CPU_RET_RAM_END .set 0xfebfffff ; CPU Retention RAM End

    SELF_LOCAL_RAM_ADDR .set 0xfede0000 ; Self Local RAM Start
    SELF_LOCAL_RAM_END .set 0xfedf7fff ; Self Local RAM End

    SELF_RET_RAM_ADDR .set 0xfedf8000 ; Self Retention RAM Start
    SELF_RET_RAM_END .set 0xfedfffff ; Self Retention RAM End

    ;-----------------------------------------------------------------------------
    ; hdwinit
    ;-----------------------------------------------------------------------------
    .align 2
    _hdwinit:
    mov lp, r14 ; save return address

    ; Clear Global RAM
    mov GLOBAL_RAM_ADDR, r6
    mov GLOBAL_RAM_END, r7
    jarl _zeroclr4, lp

    ; Clear CPU Local RAM
    mov CPU_LOCAL_RAM_ADDR, r6
    mov CPU_LOCAL_RAM_END, r7
    jarl _zeroclr4, lp

    ; Clear CPU Retention RAM
    mov CPU_RET_RAM_ADDR, r6
    mov CPU_RET_RAM_END, r7
    jarl _zeroclr4, lp

    ; Clear Self Local RAM
    mov SELF_LOCAL_RAM_ADDR, r6
    mov SELF_LOCAL_RAM_END, r7
    jarl _zeroclr4, lp

    ; Clear Self Retention RAM
    mov SELF_RET_RAM_ADDR, r6
    mov SELF_RET_RAM_END, r7
    jarl _zeroclr4, lp

    mov r14, lp
    jmp [lp]

    ;-----------------------------------------------------------------------------
    ; zeroclr4
    ;-----------------------------------------------------------------------------
    .align 2
    _zeroclr4:
    br .L.zeroclr4.2
    .L.zeroclr4.1:
    st.w r0, [r6] ; Store 0 to the current RAM address
    add 4, r6 ; Increment address by 4 bytes
    .L.zeroclr4.2:
    cmp r6, r7 ; Compare current address with end address
    bh .L.zeroclr4.1 ; Branch if r6 < r7
    jmp [lp] ; Return to caller

  • From the code flash manual R_FCL_ERR_FLOW means that ' The current request was not executed because of incorrect initialization sequence or incorrect suspend resume sequence' .

    https://www.renesas.com/en/document/apn/rh850-code-flash-libraries?language=en&r=488891

    Please check the manual for correct initialization or share your project so we can check on our side.

    Also try to increase the stack size.

  • I am encountering this problem, while flashing the bootloader using external power supply. the same code is running for another one IDE.. after flashing from another IDE, it started working on my IDE too. No changes in the code was made. The reason is unpredictable. Now again the same issue is existing. Erase function is not performing in stand alone

  • Hi 

    Thanks for the reply and valuable suggestions.

    The issue got resolved,

    Issue is,

    When connecting the debugger, Erase and Write operation is working, 

    When debugger was removed, the write and Erase operation is not working. 

    Reason is,

    I have removed the USB input from the laptop, but the connection from the ECU was not disconnected. When i removed the connection , its working. The reason behind this is in mystery. 

    All other operations are working, but, Write and Erase operations are not working.

    If you have any suggestion on this issue related to hardware, kindly let us know.