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.
Hi There.
I tried to erase Flash using F021 API, but failed during Erase Check. (used : Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, (uint32_t *)u32EraseStart) )
As a result of checking the Erase Sector area with the memory browser, the bit flip is confirmed. (0xFFFFFFFD, 0xFFFFFFBF, etc)
It was no issues with the RM44 and RM46.
I referred to the solution of a similar case on the forum, but rather side effects such as not booting occurred.
How can i resolve this issue?
My link.cmd file are:
/*---------------------------------------------------------------------------------------------------------------------------------------*/
/* Memory Map */
#define VECTOR_START_ADDR 0x00000000
#define FLASH_MAX_SIZE 0x00400000
#define VECTOR_SIZE 0x00000020
#define FLASH_API_SIZE 0x0000FFE0 /* */
#define FALSH_API_START_ADDR VECTOR_START_ADDR + VECTOR_SIZE
#define FLASH0_START_ADDR VECTOR_SIZE + FLASH_API_SIZE
#define FLASH1_START_ADDR 0x00200000
#define FLASH0_SIZE FLASH1_START_ADDR - (VECTOR_SIZE + FLASH_API_SIZE)
#define FLASH1_SIZE FLASH_MAX_SIZE - FLASH1_START_ADDR
#define STACK_START_ADDR 0x08000000 /* */
#define STACK_SIZE 0x00006000 /* 4KB x 6(SVC, IRQ, FIQ, SYS, ABT, UNDEF, USER) */
#define RAM_START_ADDR STACK_START_ADDR + STACK_SIZE /* */
#define RAM_SIZE (0x00080000 - STACK_SIZE) /* 512KB - STACK_SIZE */
#define EEPROM_START_ADDR 0xF0200000
#define EEPROM_SIZE 0x20000
MEMORY
{
/* USER CODE BEGIN (2) */
/* USER CODE END */
VECTORS (X) : origin=VECTOR_START_ADDR length=VECTOR_SIZE
FLASH_API (RX) : origin=FALSH_API_START_ADDR length=FLASH_API_SIZE
FLASH0 (RX) : origin=FLASH0_START_ADDR length=FLASH0_SIZE vfill=0xFFFFFFFF
FLASH1 (RX) : origin=FLASH1_START_ADDR length=FLASH1_SIZE
STACKS (RW) : origin=STACK_START_ADDR length=STACK_SIZE
RAM (RW) : origin=RAM_START_ADDR length=RAM_SIZE
EEPROM (RW) : origin=EEPROM_START_ADDR length=EEPROM_SIZE
/* Compile error
ECC_VECTORS : origin=0xF0400000 length=0x000004 ECC={ algorithm=algoR5F021, input_range=VECTORS }
ECC_FLASH_API : origin=0xF0400004 length=0x001FFC ECC={ algorithm=algoR5F021, input_range=FLASH_API }
ECC_FLASH0 : origin=0xF0402000 length=0x03e000 ECC={ algorithm=algoR5F021, input_range=FLASH0 }
ECC_FLASH1 : origin=0xF0440000 length=0x040000 ECC={ algorithm=algoR5F021, input_range=FLASH1 }
*/
/* USER CODE BEGIN (3) */
/* USER CODE END */
}
/* Compile error
ECC
{
algoR5F021 : address_mask = 0x003FFFF8
hamming_mask = R4
parity_mask = 0x0c
mirroring = F021
}
*/
/*
VECTORS (X) : origin=0x00000000 length=0x00000020
FLASH0 (RX) : origin=0x00000020 length=0x001FFFE0
FLASH1 (RX) : origin=0x00200000 length=0x00200000
STACKS (RW) : origin=0x08000000 length=0x00006000
RAM (RW) : origin=0x08006000 length=0x0007a000
*/
/* USER CODE BEGIN (4) */
/* USER CODE END */
/*----------------------------------------------------------------------------*/
/* Section Configuration */
SECTIONS
{
.excpt_vecs : START( ulFlashStartAddr ) {} palign=8 > VECTORS
.intvecs : {} > VECTORS /* Vector table section */
.text : {} palign=8 > FLASH0 | FLASH1 /* program code */
.const : {} palign=8 > FLASH0 | FLASH1 /* initialized const objects (string constants, variables declared const) */
.cinit : {} palign=8 > FLASH0 | FLASH1 /* initialize C global variables at startup */
.pinit : {} palign=8 > FLASH0 | FLASH1
.bss : {} > RAM /* uninitialized objects (global variables) */
.data : {} > RAM /* initialized non-const objects (global variables) */
.sysmem : {} > RAM /* the dynamic memory allocation pool */
flashAPI :
{
..\Debug\package\HC\source\f021Control.obj (.text)
..\Debug\package\HC\source\sciControl.obj (.text)
..\Debug\package\HM\source\consoleManager.obj (.text)
--library = ..\package\F021_LIB\F021_API_CortexR4_LE_L2FMC_V3D16.lib < FlashStateMachine.IssueFsmCommand.obj
FlashStateMachine.SetActiveBank.obj
FlashStateMachine.InitializeFlashBanks.obj
FlashStateMachine.EnableMainSectors.obj
FlashStateMachine.IssueFsmCommand.obj
FlashStateMachine.ScaleFclk.obj
FlashStateMachine.EnableEepromSectors.obj
Init.obj
Utilities.CalculateEcc.obj
Utilities.WaitDelay.obj
Utilities.CalculateFletcher.obj
Read.MarginByByte.obj
Read.Common.obj
Read.FlushPipeline.obj
Read.WdService.obj
Async.WithAddress.obj
Program.obj > (.text)
} palign=8, load = FLASH_API, run = 0x8070000, LOAD_START(api_load), RUN_START(api_run), SIZE(api_size)
/* USER CODE BEGIN (5) */
/* USER CODE END */
/* USER CODE BEGIN (6) */
/* USER CODE END */
}
/*---------------------------------------------------------------------------------------------------------------------------------------*/
Best regard.
Gene.
I tried to solve my problem by referring to similar topics, but I couldn't.
Rather, only side effects occurred additionally.
1. binary size was too large. (about 1GB)
2. After download, It was confirmed that it was initialized to 0xFFFFFFFF. And I tried to erase Flash using F021 API, but failed during Erase Check. (0xFFFFFFFB)
Please help me to solve this issue.
Best regards.
Gene
Hi Jinwook,
I have one example FAPI project on RM57 device
Please go through the attached project, if it doesn't helpful to solve your issue then we will do further investigation.
--
Thanks & regards,
Jagadish.
Dear Jagadish.
Thank you for your suppoert.
Your sample code works well on my board. It's already confirm to work well on my board.
My issue is that failure occurs during the erase confirmation after erase completion.
And, there are additional issue during flash R/W.
My work flow is follow as. (It's program update function, and Used F021 API - Fapi_issueProgrammingCommand, Fapi_issueAsyncCommandWithAddress)
--------------------------------------------------------------------------------------------------------------------------------------------------------
1. For new program download, Erase 0x40000 from Flash Bank0 0x00060000 Address
2. After Erase, Occurs failure during checking erase. (For passing, Blocked this code)
3. New program download to Flash Bank0 0x00060000 address.
4. Erase Old Program area (From 0x00000000 to 0x00040000)
5. After Erase, Occurs failure during checking erase, too. (For passing, Blocked this code)
6. For new program update, Copy from 0x00060000 to 0x00000000 by 0x40000 size.
At this time, when copying an area that exceeds the size of the new program, an exception occurs. (new program size is 0x27000 - size is irrelevant)
That is, an exception occurs when trying to copy the address of 0x27000.
(For test, artificially pass it using Jtag)
7. After copy completion, To check if copying was successful, compare data as much as 0x40000 from 0x00000000 and 0x00060000.
At this time, an exception occurs. (Results confirmed through CCS Memory browser, it was confirmed that the actual value was different)
--------------------------------------------------------------------------------------------------------------------------------------------------------
Note : Specifically, when the system is rebooted after an exception occurs in No. 6, it is confirmed that the New program is executed.
That's it.
I'm looking forward to your help once again.
Best regards.
Gene
Hi Jinwook,
Understood your issue, give me some time to debug the issue at my end and i will try to provide an update as soon as possible.
--
Thanks & reagards,
Jagadish.
Hi Jinwook,
I created one example project for Linker based ECC generation example.
RM57_Linker_ECC_Generation_TEST.zip
In this project, i filled unused region of the flash and bank-7 with the 0xFF values, also filled ECC region with corresponding values.
After running this project i verified and found all the unused flash regions with 0xFF and bank-7 also filled with oxFF.
To run this project properly make sure below two things.
1. Make sure debug settings as below
2. If you are using latest CCS then make sure to ON below option
Note: I didn't check with FAPI routines yet.
--
Thanks & regards,
Jagadish.
Dear jagadish.
Sorry for late reply.
The problem is still not solved.
Your solution is only side effects occurred additionally.
1. *.out file is normal. But binary size (*.bin) was too large. (about 4GB)
2. After download, It was confirmed that it was initialized to 0xFFFFFFFF. And I tried to erase Flash using F021 API, but failed during Erase Check. (0xFFFFFFFB)
I'm looking forward to your help again.
best regards.
Gene
Hi Jinwook,
Thanks for providing details, i will verify and provide update.
--
Thanks & regards,
Jagadish.
1. *.out file is normal. But binary size (*.bin) was too large. (about 4GB)
Yes, the binary file is around 4GB since contains the content of the whole memory range (from 0x00000000 to 0xF0480000 (ECC space)). You should not use linker ECC for binary file generation. The binary is normally for application image whose ECC can be calculated using Flash APIs.
2. After download, It was confirmed that it was initialized to 0xFFFFFFFF. And I tried to erase Flash using F021 API, but failed during Erase Check. (0xFFFFFFFB)
Is ECC generated by Linker cmd script? or by CCS?
If the ECC of the Application image is generated by CCS rather than the linker cmd script, the size of the Application binary file should not be 4GB.
You can generate the ECC for the whole flash using BootLoader Linker CMD, and the ECC of Application image can be generated and programmed using F021 Flash APIs from Bootloader.