Model on EVB doesn't start after re-partitioning for EEPROM

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

Model on EVB doesn't start after re-partitioning for EEPROM

2,103 Views
Maciek
Contributor V

I've been using S32K144 EVB with default memory settings without problems. FCFG1 register shows 0xC for the DEPART field then (which means all the FlexNVM used as D-Flash).

Then I've re-partitioned memory on S32K144 EVB using 'program partition command' from debugger. I've checked FCFG1 register and it shows 0x4 as expected (all FlexNVM used for EEPROM emulation).  Next, I've checked EEPROM functionality using some projects in S32DS - and it works as expected.

Now I've returned to MBD Toolbox and tried to build and load one of my previous models. The models are built without any problems/warnings. Then I see short blinks of the red LED near the RESET button on EVB and eventually this LED is turned on constantly (red light near reset button constantly 'ON'). And nothing happens - like there is no program running. Because there is no feedback from Simulink Diagnostic Viewer - I don't know what to do next...

After 'resetting' the device (erasing; FCFG1 returns 0xF - 'no functionality assigned to FlexNVM) - I again can see my models working on EVB after download.

How to get my models running after re-partitioning FlexNVM for EEPROM (with FCFG1:DEPART showing 0x4)?

Thanks

Maciek

Update (22.03): the same models when exported to S32DS, compiled using S32DS and loaded using S32DS debugger - run without problems on partitioned devices!

10 Replies

1,797 Views
Maciek
Contributor V

Hi mariuslucianandrei,

As to the linker file used with repartitioned device - it's the same linker script that is copied from Toolbox directory during 'Build' stage of the model to the model '_rtw' directory. After importing to S32DS this linker script is by default used in 

C/C++ Build->Settings->Tool Settings->Standard S32DS C Linker ->General->Script files. I was building in Simulink and in S32DS with standard Flash linker script.

Waiting for Your response

Maciek

0 Kudos

1,797 Views
mariuslucianand
NXP Employee
NXP Employee

Hello Maciek‌,

I have tried to diff the linker file attached in the previous reply but it is the same with the one default that we provide.

Let me know more about your project: basically do you try to obtain the EEPROM functionality in the same way described in this application note https://www.nxp.com/docs/en/application-note/AN11983.pdf ?

Regards,

Marius

0 Kudos

1,797 Views
Maciek
Contributor V

Hi mariuslucianandrei ,

1. The linker file attached in the previous e-mail was the standard linker file from the toolbox. In standard linker files FlexNVM is not assigned so I used it to check EEPROM functionality. Now we use our own linker file for assigning specific arrays and structures to the FlexRAM region. It doesn't matter which linker file is used - it's enough to change the default partition end the program doesn't start after download.

2. You can do the following to observe the effects I described in the first post in this thread:
- change the partition in S32DS in debugger settings ('Enable partitioning for the device:') with code '0204' and observe DEPART in FCFG1 to confirm new partitioning (all FlexNVM assigned to emulated EEPROM)
- try to build and load any example model from S32K1xx toolbox to the EVB (we checked this with two S32K144 EVB boards) - it won't start as I described earlier

3. If You now export the same (already generated and built) model to S32DS - it builds, loads and runs without problems

4. The mentioned AN11983 note describes partitioning process using Flash commands, but we use PE Micro 'partition command' available in PE Micro debugger settings.

I'm not sure now - but if I remember correctly after such a failed attempt to download the application from Simulink I've observed (maybe not always) the DEPART field in FCFG1 resetted to '1111'. It looked like the toolbox's debugger config. erased the partiton settings from MCU. Maybe this is helpfull ?

Maciek

0 Kudos

1,796 Views
mariuslucianand
NXP Employee
NXP Employee

Hello Maciek‌,

Just wanted to keep you updated: with the new release Model-Based Design Toolbox for S32K1xx Automotive Microprocessors Version 4.2.0 we've added support for the EEPROM functionality (blocks to make read/write operations to non-volatile memory).

We also noticed the same behavior related to the flashing models that support EEPROM over OpenSDA, paulvlase can provide more details here. On the S32K144EVB the current firmware for the OpenSDA, flashing is not possible for the models that uses the EEPROM functionality, so the only workaround for this is to flash the generated code over SWD from S32DS. For all the other boards, PEMicro provides newer firmware that allows flash erasing for the models that use EEPROM blocks.

We will keep you updated if there are any news related with a newer firmware for OpenSDA for S32K144.

Hope this helps,

Marius

1,796 Views
Maciek
Contributor V

Hi mariuslucianandrei,

thanks for the update. We are using EEPROM already via custom block library that is specialized for our tasks (we store only 8-bit int parameters, 32-bit config registers and some configuration strings) but I will check Your implementation also.

The problem with flashing models onto partitioned devices is no longer relevant because we are using custom boards - so we routinely eksport projects to S32DS and flash from there... But anyway - thanks for the clarification.

By the way: there are some annoying problems with exporting projects for S32K116 parts:

- we need to set by hand ARM family option to 'cortex-m0plus'

- we need to set path to AMMCLIB by hand

- we need to define by hand macro start_from_flash 

- and there is always debugger option 'GDB Client Settings' to be set - but this is probably Eclipse problem ?

When we must repeat all this actions with each firmware iteration many times a day - it is really annoying.

Best regards

Maciek

0 Kudos

1,797 Views
constantinrazva
NXP Employee
NXP Employee

Hello Maciek ,

First of all, have you been having these problems in the new release as well ?

Let me go through your issues

By the way: there are some annoying problems with exporting projects for S32K116 parts:

- we need to set by hand ARM family option to 'cortex-m0plus'

- we need to set path to AMMCLIB by hand

- we need to define by hand macro start_from_flash 

- and there is always debugger option 'GDB Client Settings' to be set - but this is probably Eclipse problem ?

 

1 + 2) these should have been fixed on our latest release (4.2.0) - both cortex-m0plus option and AMMCLib path should be set

3) could you elaborate on this? The first 2 we knew, but we never got this issue reported. If it persists in the latest release we could work out a patch now.

4) It will create a complete launch configuration if you check the box as in the image below (even with the GDB Client settings); but indeed there seems to be an issue with the S32DS when importing a project for S32K11x (for S32K14x seems to be working fine). We will look into this and get back with a patch most probably.

pastedImage_4.png

Kind regards,

Razvan.

0 Kudos

1,797 Views
Maciek
Contributor V

Hi constantinrazvan.chivu and mariuslucianandrei,

everything I've said is happening in 4.1.0 version. When we switch to the latest version - I let You know if problems still exist. (Easy and fast import of projects is needed because we frequently debug our own code inserted via custom blocks).

If we don't set this macro def. 'START_FROM_FLASH' - after programming the board, the code doesn't start after power reset. This macro is always defined 'by default' when You create new projects in S32DS...

Have You solved the problem with changing default linker files to custom linker files that I've reported in 4.1.0 ?

Regards

Maciek

0 Kudos

1,796 Views
constantinrazva
NXP Employee
NXP Employee

Hello Maciek ,

Yes, the problem with default linker file was resolved in 4.2.0.

Regarding the START_FROM_FLASH, can you go into more details about what steps you take to get it? Because we did not manage to replicate this.

Kind regards,

Razvan.

0 Kudos

1,796 Views
mariuslucianand
NXP Employee
NXP Employee

Hello Maciek‌,

Thank you for telling us about the issues with exporting the projects for S32K116 parts. constantinrazvan.chivu‌, can you comment on this?

So, for each code generation, you import the generated code in the D32DS, rebuild and flash the application?

I am asking this question because if you only want to flash the elf/mot already generated by the Simulink scripts, you can do this without importing the whole project in the S32DS. You have to set a project for S32K116 and only update the location for the elf file when you want to flash. I described the entire steps here, today S32K144EVB Communication Problem with Freemaster .

Hope this helps,

Marius

0 Kudos

1,796 Views
mariuslucianand
NXP Employee
NXP Employee

Hello Maciek‌,

Related with the issue also described here https://community.nxp.com/thread/528013  we will keep investigating this on this thread. So I assume that the linker attached on the previous reply is the one modified. I will investigate and reply with What I found.

Marius

0 Kudos