Flash Driver

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Flash Driver

Jump to solution
4,157 Views
bjrajendra
Senior Contributor I

Hello all,

I would like to create a Flash Boot loader in S32K144 device. I do implemented the same for MPC5602P based on the AN_qorriva_bootloader prepared for MPC55xx/56xx devices in Code Warrior platform.

For that I got a flash_drivers from the location 

C:\NXP\S32DS_ARM_v2018.R1\S32DS\S32SDK_S32K14x_EAR_0.8.6\platform\drivers\src\flash_driver.c

C:\NXP\S32DS_ARM_v2018.R1\S32DS\S32SDK_S32K14x_EAR_0.8.6\platform\drivers\inc\flash_driver.h

I included both flash_driver.c & flash_driver.h in the a project I tried build the project, It seems like there are so many undeclared variables. I would like to know the where exactly I can get the actual flash_driver.h to avoid all the errors. Any example file will be helpful

Also I would like to know where I can change the ROM image file in S32DS (other than lcf file) just like what we do it for CodeWarrior.

Thanks in advance,

BJ Rajendranath.

0 Kudos
1 Solution
3,003 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello BJ Rajendranath,

You can look at the application note SW for the S32K1xx bootloader AN12218.  

https://www.nxp.com/docs/en/application-note/AN12218.pdf 

SW:

https://www.nxp.com/docs/en/application-note-software/AN12218SW.zip 

This bootloader uses fsl_flash_driver_c90tfs.c and fsl_flash_driver_c90tfs.h .

I assume that the .lcf file is not used in the S32 Design studio. There is a .ld file instead.

I hope it helps.

Best Regards,

Diana

View solution in original post

11 Replies
3,004 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello BJ Rajendranath,

You can look at the application note SW for the S32K1xx bootloader AN12218.  

https://www.nxp.com/docs/en/application-note/AN12218.pdf 

SW:

https://www.nxp.com/docs/en/application-note-software/AN12218SW.zip 

This bootloader uses fsl_flash_driver_c90tfs.c and fsl_flash_driver_c90tfs.h .

I assume that the .lcf file is not used in the S32 Design studio. There is a .ld file instead.

I hope it helps.

Best Regards,

Diana

3,003 Views
bjrajendra
Senior Contributor I

Hi Diana,

 

I opened a similar query with another post, with much detailed explaination. Unable to Erase Sector  

 

Kindly help in solving the issue.

 

Thanks in advance,

Raju

0 Kudos
2,999 Views
bjrajendra
Senior Contributor I

Hi Diana,

Thanks for your guidance & providing the right document to initiate the work. I'll look into it and comeback if I have any doubts.

 

With having a prior experience with the Flash Bootloader, I have below questions

1. I would like to keep the Bootloader at the starting address & user application later, since I would like to jump from the boot loader to user_application only if there user application (which we will know based on the ECC key)

2. Also I would like to use Error Correcting Code (ECC) at the end of the address for checking successful flash. What are the ECC used for S32K14x series for keeping the it at the end of the address

Thanks & Regards,

BJ Rajendranath.

0 Kudos
3,003 Views
cuongnguyen
Contributor II

For me to check if application is valid, I used magic bytes A5A5 at the end of applicaion.

0 Kudos
3,003 Views
bjrajendra
Senior Contributor I

Hi Cuong Nguyen,

Thanks for your response.

But I we use the A5A5 at the end of the application, I want to erase the key with FFFF whenever I want to jump to bootloader from the application since my bootloader checks the value A5A5 whether the application exists or not.

If we erase A5A5 key with another value say FFFF (without erasing the whole sector) I think it will generate a ECC Error accordingly interrupt will be generated (if enabled) 

Thanks & Regards,

BJ Rajendranath

0 Kudos
3,003 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

let me jump into this thread.

I used that trick with ECC in the bootloader because erasing of block takes a lot of time. On S32K it's possible to erase only single sector which is much faster. So, one option is to use one dedicated sector for the key and erase it when needed.

I did quick test on S32K regarding the ECC because it is not documented in the RM. I can see that it is the same as on MPC5 devices. If you use '0xFFFF' or '0x0000' chunks then it will work in the same way.

Regards,

Lukas

3,003 Views
bjrajendra
Senior Contributor I

Hi Lukas,

 

Very Glad to meet you again.

 

 I implemented the flash Bootloader for MPC5602P based on the AN_qorriva_bootloader which was prepared for MPC55xx/56xx devices on Code Warrior platform.

 

Now I want to implement similar structure of flash bootloader on S32K144. I need your guidance in understanding & generating the linker file so that the APPKEY will fit into the srec file.

 

My basic questions are

 

1. Can I use the same list of ECC Codes which were used for MPC5x series instead of 0xAA55AA55 at the end of the application. Else better to erase the whole sector before jumping to bootloader?

2. Does it requires any setting in the project other than linker to generate the .srec file just like what we do in Code Warrior ROM Image settings. 

3. Also I had seen the bootloader_S32K file on the example project where it uses the 

const volatile uint32_t APPKEY __attribute__ ((section(".appkey"))) = 0x55AA55AA;

const volatile uint32_t RCHW[] __attribute__ ((section(".cfmConfigure"))) = { 0x015A015A, (uint32_t)Reset_Handler, 5000000, (uint32_t)&APPKEY } ;

Kindly clarify the importance of these two lines ?

Kindly help in solving these issues.

 

Thanks in advance,

 

Regards,

BJ Rajendranath.

0 Kudos
3,003 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

1. I did quick check and it works in the same way as on MPC5xxx. So, it's up to you, both ways are possible.

2. That's toolchain related setting. Not necessary on S32K.

3. That's required by Rappid bootloader. It will not work without these constants. It's described in the release notes - you can find it in the installation folder of the bootloader (c:\Freescale\RAppIDBL\ReleaseNotes.pdf).

Regards,

Lukas

3,003 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hi,

You can write this byte at the end of the application, but how is it related to ECC?

The ECC checksum is generated during the programming, but we do not have access to ECC checksum value.

Best Regards,

Diana

0 Kudos
3,003 Views
bjrajendra
Senior Contributor I

Hi Diana,

Thanks for your swift response.

My intention of keeping an ECC at the end of the application is to erase the ECC while jumping to bootloader. It should not generate any kind of ECC fault detection during that time.

My understanding in ECC as per the document AN5200, MPC56xx series having a series of ECC Codes which can generate the same checksum value. That means erasing the ECC Code with the another ECC Code of having same checksum will not generate any kind of ECC Error

Regards,

BJ Rajendranath

0 Kudos
3,003 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hi BJ Rajendranath,

1. You can keep the bootloater at starting address 0x0000 and the application, for example, at the address 0x8000. This changes should be done in the Linker_Files of the projects.

I'm not sure if I understand your second question, but there is no ECC key and cannot be kept at the end of the address.

During "read flash memory" can be detected double-bit or single-bit ECC error.

I would like to recommend you to look at the Safety Manual at chapter 3.2 ECC

 https://www.nxp.com/webapp/Download?colCode=S32K1XXSM 

I hope it helps.

Best Regards,

Diana