Hi Giovanni,
Thanks for the reply. I shall check it now
Regards,
Akshai M
Help regarding MFSConfig
Re: Help regarding MFSConfig
Hi Giovanni,
I wrote the following code to check the flash operation. The program would just try to erase the flash The behaviour of the application is different while trying to boot from banks 1 and 2. The program for reference is shown below.
I perform a mass erase of the chip via STlink and flash to 0x08000000. The program starts and does the flash erase and makes a pass but I noticed something strange. I added some prints in to make it clear.
The address 0x0801D800 ( 134338560) although it says it's erased, it is not as per the readout from STlink.
This does not seem to affect read /writes though. This apparently becomes a problem when booting from bank 2 i.e. when I flash to 0x08020000 after a complete flash erase via STlink. The log is shown below
My concern is why does efl_lld_start_erase_sector(..) not return an error even though the flash is not empty while booting from Bank 1. If this is expected behaviour why does it give an error while booting from Bank 2 ?
I wrote the following code to check the flash operation. The program would just try to erase the flash The behaviour of the application is different while trying to boot from banks 1 and 2. The program for reference is shown below.
Code: Select all
#include "osal.h"
#include "hal.h"
#include "hal_mfs.h"
#include "chprintf.h"
#include <stdlib.h>
MFSDriver mfs1;
const MFSConfig mfscfg1 = {
.flashp = (BaseFlash *)&EFLD1,
.erased = 0xFFFFFFFFU,
.bank_size = 4096U,
.bank0_start = 59U,
.bank0_sectors = 2U,
.bank1_start = 61U,
.bank1_sectors = 2U
};
/**
* Get the active flash bank (the bank the controller started from).
*
* \return Active flash bank number (1 or 2)
*/
int _get_active_bank(void)
{
if (!(SYSCFG->MEMRMP & SYSCFG_MEMRMP_FB_MODE))
return 1; // Flash Bank 1 mapped at 0x0800 0000 ( (and aliased @0x0000 0000 if BFB2 is set)
else
return 2; //Flash Bank2 mapped at 0x0800 0000
}
/**
* Get bank select status.
*
* \return Bank select status.
*/
int _get_bank_select(void)
{
return (FLASH->OPTR & FLASH_OPTR_BFB2) ? 1 : 0; // Dual-bank boot disable/enable
}
int main(void) {
halInit();
osalSysEnable();
sdStart(&SD4, NULL);
chprintf(stream, "Starting up ! on active bank %d , selected %d \n", _get_active_bank(), l_get_bank_select());
mfs_error_t error;
eflStart(&EFLD1, NULL);
mfsObjectInit(&mfs1);
error = mfsStart(&mfs1, &mfscfg1);
if (error != 0) {
chprintf(stream, "mfsStart Error %d\n", error);
}
error = mfsErase(&mfs1);
if (error != 0) {
chprintf(stream, "mfsErase Error %d\n", error);
}
}
I perform a mass erase of the chip via STlink and flash to 0x08000000. The program starts and does the flash erase and makes a pass but I noticed something strange. I added some prints in
Code: Select all
efl_lld_verify_erase(..)
Code: Select all
Starting up ! on active bank 1 , selected 1 ␊
strt addr 134342656 ␊
␊
strt addr 134344704 ␊
␊
strt addr 134338560 ␊
␊
strt addr 134340608 ␊
␊
strt addr 134342656 ␊
␊
strt addr 134344704 ␊
␊
strt addr 134338560 ␊
␊
strt addr 134340608 ␊
␊
strt addr 134342656 ␊
␊
strt addr 134344704
The address 0x0801D800 ( 134338560) although it says it's erased, it is not as per the readout from STlink.
This does not seem to affect read /writes though. This apparently becomes a problem when booting from bank 2 i.e. when I flash to 0x08020000 after a complete flash erase via STlink. The log is shown below
Code: Select all
Starting up ! on active bank 2 , selected 1 ␊
strt addr 134338560 ␊
␊
strt addr 134340608 ␊
␊
strt addr 134342656 ␊
␊
strt addr 134344704 ␊
␊
strt addr 134338560 ␊
␊
Error efl_lld_verify_erase 0xEC705ADE ␊
My concern is why does efl_lld_start_erase_sector(..) not return an error even though the flash is not empty while booting from Bank 1. If this is expected behaviour why does it give an error while booting from Bank 2 ?
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Help regarding MFSConfig
Hi,
I never tested that L4 EFL driver myself, it has been contributed. I will ask if others gave it a try under those conditions.
You may want to create a minimal project showing the problem (no MFS required, just EFL calls, the problem seems to be there).
Giovanni
I never tested that L4 EFL driver myself, it has been contributed. I will ask if others gave it a try under those conditions.
You may want to create a minimal project showing the problem (no MFS required, just EFL calls, the problem seems to be there).
Giovanni
Re: Help regarding MFSConfig
Hi Giovanni,
Is there a test application for just EFL driver without using MFS ?
Akshai M
Is there a test application for just EFL driver without using MFS ?
Akshai M
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Help regarding MFSConfig
No, just with MFS but those work, you need to make something that fails so we can try to debug.
Try to modify the existing EFL-MFS demo.
Giovanni
Try to modify the existing EFL-MFS demo.
Giovanni
Re: Help regarding MFSConfig
Hi Giovanni,
I was able to make the EFL work by booting from different banks. It seems like an issue with the non-continuous page indexes used by the chip. Writing with offsets works but sector/page operations would result in an error. I should be able to push a hotfix soon. But how do I contribute ? Do you have a git repo ?
Also, I noticed alignment issues when writing 2-byte values. Now using 4/8byte values and that problem was solved.
Regards,
Akshai M
I was able to make the EFL work by booting from different banks. It seems like an issue with the non-continuous page indexes used by the chip. Writing with offsets works but sector/page operations would result in an error. I should be able to push a hotfix soon. But how do I contribute ? Do you have a git repo ?
Also, I noticed alignment issues when writing 2-byte values. Now using 4/8byte values and that problem was solved.
Regards,
Akshai M
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Help regarding MFSConfig
Hi,
Just post a patch or files here or join Discord for discussion.
Giovanni
Just post a patch or files here or join Discord for discussion.
Giovanni
Return to “Development and Feedback”
Who is online
Users browsing this forum: No registered users and 17 guests