renesas-rx / amazon-freertos

A fork/prototype of the Amazon FreeRTOS to support Renesas RX MCUs. Please refer to our wiki for more details.
https://github.com/renesas-rx/amazon-freertos/wiki
MIT License
7 stars 6 forks source link

global variable "flash_error_code " is not initialized #24

Open HirokiIshiguro opened 4 years ago

HirokiIshiguro commented 4 years ago

Describe the bug global variable "flash_error_code " is not initialized so always success during whole of bootloader sequence using R_FLASH_Erase(), R_FLASH_Write() etc.

https://github.com/renesas-rx/amazon-freertos/blob/1f50ef5b1971183c29c6d6748b4a0a3635de2fdf/demos/renesas/rx65n-rsk/e2studio/ccrx/boot_loader/type2/src/boot_loader.c#L1168

System information

Expected behavior Each R_FLASH_Erase(), R_FLASH_Write() callback can detect the errors.

Screenshots or console output none

To reproduce none (difficult)

Code to reproduce the bug none (difficult)

Additional context Before:

static void my_flash_callback(void *event)
{
    uint32_t event_code = FLASH_ERR_FAILURE;
    event_code = *((uint32_t*)event);
    if((event_code == FLASH_INT_EVENT_WRITE_COMPLETE) || (event_code == FLASH_INT_EVENT_ERASE_COMPLETE))
    {
        flash_error_code = FLASH_SUCCESS;
    }

After

static void my_flash_callback(void *event)
{
    uint32_t event_code = FLASH_ERR_FAILURE;
    event_code = *((uint32_t*)event);
        flash_error_code = 0xffffffff; /* error */
    if((event_code == FLASH_INT_EVENT_WRITE_COMPLETE) || (event_code == FLASH_INT_EVENT_ERASE_COMPLETE))
    {
        flash_error_code = FLASH_SUCCESS;
    }

Thank you!