Other Parts Discussed in Thread: UNIFLASH
hi ti
I need to store some data, which still exists after reboot. And i will read out the data when mcu1_0 init. How to save and read ?
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 fengying li
So the Rom code initialise the emmc if you are using emmc boot mode then once it load R5 spl
,Now R5 SPL will initialise emmc for the next stage booting.
So after the nc1_o init only your emmc is up.
Can you elaborate your exact use case.
Regards
Diwakar
hi Diwakar
There are some property values nedd to be store, the value will not change when board power off. It will be read out as the condition to initial mcan parameter in mcu1_0 initialization.
Hi fengying li
Which boot mode you are using are you using emmc boot mode? as emmc will get initialised only in emmc boot mode.
In which partition of the emmc you want to keep the data , what is the format type ?
Regards
Diwakar
hi Diwakar
Yes,we will boot from emmc. The partition file as fllowing. I will keep the data in persist partion, this part will not format when flash image. Does the format of stored data affect the storage and reading methods?At present, I want to store some integer data。
tda4-j721s2/linux-sdk / board-support/u-boot/include/configs/j721s2_evm.h
#define PARTS_DEFAULT \
/* Linux partitions */ \
"name=rootfs_a,start=0,size=4096M,uuid=${uuid_gpt_rootfs_a};"\
"name=rootfs_b,size=4096M,uuid=${uuid_gpt_rootfs_b};"\
"name=cache,size=4096M,uuid=${uuid_gpt_cache};"\
"name=persist,size=200M,uuid=${uuid_gpt_persist};"\
"name=data,size=-,uuid=${uuid_gpt_data}\0"
hi Diwakar
I'm so sorry, I understand wrong! Persist part file system is ext4.
Hi fengying li
Is there any particular requirement to store the data to the emmc we can store your static data in some array inside the code itself.
As it is ext4 it will require some time to check how to do this in SPL.
Regards
Diwakar
Hi fengying li
Ext4 is supported in the SPL you need to enable this flag CONFIG_SPL_FS_EXT4 in your config file
In SPL you can change the code in spl_mmc.c to read from the ext4 partition of the emmc.
Example code:
/*Function call*/ spl_read_data(mmc_get_blk_desc(mmc),2,"/home/root/test.txt");//2 is the partion no /*Function Defination*/ int spl_read_data(struct blk_desc *block_dev,int partition,const char *filename) { s32 err; struct disk_partition part_info = {}; char buf[20]={0}; loff_t filelen, actlen; if (part_get_info(block_dev, partition, &part_info)) { printf("spl: no partition table found\n"); return -1; } ext4fs_set_blk_dev(block_dev, &part_info); err = ext4fs_mount(0); if (!err) { #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("%s: ext4fs mount err - %d\n", __func__, err); #endif return -1; } err = ext4fs_open(filename, &filelen); if (err < 0) { puts("spl: ext4fs_open failed\n"); } else { puts("spl:ext4fs_open pass\n"); } err = ext4fs_read((char *)buf, 0, sizeof(buf), &actlen); if (err < 0) { puts("spl: ext4fs_read failed\n"); } else { printf("spl: ext4fs_read PASS %s\n",buf); } }
Regards
Diwakar
hi Diwakar
How to get the store data when mcu1_0 boot ? It will be read out as the condition to initial mcan parameter in mcu1_0 initialization
Hi fengying li
Before MC1_0 you will not be able to get the data from the emmc once the mc1_0 is up it will initialise the emmc so that R5 SPL can get the second stage image.
,so once the emmc is up after MCU1_0 init you can get the stored data.
When you want your mcan parameter , you can read the parameter after initialising the emmc.
Help me in understanding where exactly you are facing the issue?
Regards
Diwakar
hi Diwakar
I want to store some data, which will not be lost or changed even if the power is off. Our mcan is in mcu1-0. Every time the board bootup,When MCu1_0 is started, I need to read the stored data every time to decide how to initialize the register of mcan. I don't kown how to store and read out. i need to read it out when mcu1_0 initial.
Hi fengying li
Our mcan is in mcu1-0
can you elaborate more on this is mcan code is inside mc1_0 (R5 spl )?
SPL boot flow is like this
ROM code -->R5 SPL--> A72 SPL -->-ATF-->OPTEE->UBOOT -->LINUX
You can see boot flow here:
software-dl.ti.com/.../Foundational_Components_U-Boot.html
Do you want to get the store data during MC1_0 initialisation which is done by ROM code or when the R5 SPL is running on it ?
Regards
Diwakar
hi Diwakar
Thanks a lot for your help and I'm so sorry I didn't express myself clearly.
in file tda4\rtos-sdk\vision_apps\platform\j721e\rtos\mcu1_0\main.c
static void appMain(void* arg0, void* arg1)
{
TaskP_Handle sciserverInitTask;
TaskP_Params sciserverInitTaskParams;
appUtilsTaskInit();
appSciserverSciclientInit();
/* Initialize SCI Client Server */
TaskP_Params_init(&sciserverInitTaskParams);
sciserverInitTaskParams.priority = INIT_SCISERVER_TASK_PRI;
sciserverInitTaskParams.stack = gSciserverInitTskStack;
sciserverInitTaskParams.stacksize = sizeof (gSciserverInitTskStack);
sciserverInitTask = TaskP_create(appSciserverInit, &sciserverInitTaskParams);
if(NULL == sciserverInitTask)
{
OS_stop();
}
appInit();
snrRemoteSericeInit();
appDiagnosticServiceInit();
App_mcanInit();---------> I need to read the store data here.
.....
.........}
Hi,
Catching up with thread here.
Is there any specific requirement for storing the data in eMMC? How big is the data that you wanna store?
Regards,
Parth
hi Parth
We need to store a value when the board is started for the first time (This value may be modified in future system operation ). In each subsequent boot process, this value is read out when the mcan is initialized. For example, if the read value is 1, then can0 is configured as can protocol. If the read value is 2, can0 is configured as canfd protocol. I want to ask how to store this value and how to read it after storage.
Our mcan driver is in mcu1_ 0, the code is as follows, tda4\rtos-sdk\vision_apps\platform\j721e\rtos\mcu1_0\main.c
static void appMain(void* arg0, void* arg1)
{
TaskP_Handle sciserverInitTask;
TaskP_Params sciserverInitTaskParams;
appUtilsTaskInit();
appSciserverSciclientInit();
/* Initialize SCI Client Server */
TaskP_Params_init(&sciserverInitTaskParams);
sciserverInitTaskParams.priority = INIT_SCISERVER_TASK_PRI;
sciserverInitTaskParams.stack = gSciserverInitTskStack;
sciserverInitTaskParams.stacksize = sizeof (gSciserverInitTskStack);
sciserverInitTask = TaskP_create(appSciserverInit, &sciserverInitTaskParams);
if(NULL == sciserverInitTask)
{
OS_stop();
}
appInit();
snrRemoteSericeInit();
appDiagnosticServiceInit();
App_mcanInit();---------> I need to read the store data in this function.
.....
.........}
hi Parth
How big is the data that you wanna store?
------------------------>The data mcan need is a byte, If possible, we also want to store some can messages during the operation of mcan and read them after the next mcan startup. These data are less than 3KB.
Hi,
Do you have OSPI flash on your system? We can store and read the data in the flash at any point of time. We just need to make sure it is not used by Linux.
Regards,
Parth
Do you have any non-volatile memory other than eMMC? Storing and reading from eMMC is not gonna be straight forward in this case as Linux will also me using the eMMC.
hi Parth
There is no non-volatile memory other than eMMC. Any other method can do this?
Hi,
You can use the eMMCs boot partition to store and read the data. Please refer to the file <PDK>/packages/ti/board/utils/uniflash/target/src/emmc/emmc.c
If you are on SDK 8.5 or above, you can also refer to <PDK>/packages/ti/boot/sbl/src/emmc as well.
Regards,
Parth
Hi,
Is this issue still open?
Did you refer to the example above?
You can use the eMMCs boot partition to store and read the data. Please refer to the file <PDK>/packages/ti/board/utils/uniflash/target/src/emmc/emmc.c
If you are on SDK 8.5 or above, you can also refer to <PDK>/packages/ti/boot/sbl/src/emmc as well.
Regards,
Parth
Hi,
Apologies for long silence.
what exactly is pending on this issue?
You can use the eMMCs boot partition to store and read the data. Please refer to the file <PDK>/packages/ti/board/utils/uniflash/target/src/emmc/emmc.c
If you are on SDK 8.5 or above, you can also refer to <PDK>/packages/ti/boot/sbl/src/emmc as well.
I believe the above reference should serve as a good reference for your use case.
Regards,
Parth