S32K344 - FEE Integration with Simulink - MBDT 1.4

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

S32K344 - FEE Integration with Simulink - MBDT 1.4

1,387 Views
rishikesh_c
Contributor III

I am trying to use the Fee APIs on S32K344. I am building my model on Simulink with MBDT version 1.4. Since there is no support for NVM in the toolbox, I am trying to call the C functions through MATLAB function blocks. I had asked a similar question here which was solved for MBDT version 1.3. 

I am trying to follow similar steps but I am getting errors before I can even call the required Fee and MemAcc functions. On S32 Design Studio version 3.5 there is an example project for Fee which builds and flashes perfectly on my S32K344 board. I am replicating the configurations for the MemAcc, Mem_43_InFls and Fee components in the MCAL layer and the Cache_Ip in the Drivers since Cache is being used in one of the settings of Mem_43_InFls - specifically the "Mem Synchronize Cache" option

The error I get after I make these configurations, and without adding the MATLAB function blocks to call Fee_MainFunction() and MemAcc_MainFunction() before calling the actual FEE API calls as in the link above is as follows:


gmake: *** [C40_Ip.o] Error 1 gmake: *** Waiting for unfinished jobs.... C:\Rishikesh\NVMStuff_MBDT14\nvm_stuff_ert_rtw>echo The make command returned an error of 2 The make command returned an error of 2 C:\Rishikesh\NVMStuff_MBDT14\nvm_stuff_ert_rtw>exit /B 1 ### Build procedure for nvm_stuff aborted due to an error.

After scrolling through the diagnostics viewer quite a bit, I spotted this error:


C:/Rishikesh/NVMStuff_MBDT14/nvm_stuff_Config/RTD/src/C40_Ip.c:575:11: error: implicit declaration of function 'Cache_Ip_InvalidateByAddr' [-Werror=implicit-function-declaration] 575 | (void)Cache_Ip_InvalidateByAddr(CACHE_IP_CORE, CACHE_IP_DATA, Address, Length); | ^~~~~~~~~~~~~~~~~~~~~~~~~ C:/Rishikesh/NVMStuff_MBDT14/nvm_stuff_Config/RTD/src/C40_Ip.c:575:37: error: 'CACHE_IP_CORE' undeclared (first use in this function) 575 | (void)Cache_Ip_InvalidateByAddr(CACHE_IP_CORE, CACHE_IP_DATA, Address, Length); | ^~~~~~~~~~~~~ C:/Rishikesh/NVMStuff_MBDT14/nvm_stuff_Config/RTD/src/C40_Ip.c:575:37: note: each undeclared identifier is reported only once for each function it appears in C:/Rishikesh/NVMStuff_MBDT14/nvm_stuff_Config/RTD/src/C40_Ip.c:575:52: error: 'CACHE_IP_DATA' undeclared (first use in this function) 575 | (void)Cache_Ip_InvalidateByAddr(CACHE_IP_CORE, CACHE_IP_DATA, Address, Length);

I don't understand why this error is occurring since all the files are generated by the S32 Design Studio Config Tool I use to configure my S32K344 project in Simulink. Additionally, the configurations are identical to the ones in the Fee_example_s32k344 in Design Studio 3.5 which builds and flashes properly on my board.

What could be causing this problem? 

7 Replies

1,049 Views
FlorinCiuca
NXP Employee
NXP Employee

Hello and sorry for my belated public reply to this thread.

Based on discussions with @rishikesh_c , we were able to identify the first problem and its subsequent fix. The Cache_Ip Driver configuration settings were being overwritten by similar settings in the Mcl component. Generally, this issue can be solved in two ways: either by performing the setting in the Mcl component and not using Cache_Ip driver at all, or by only using Cache_Ip Driver if no Mcl functionalities are needed. This project was created by extending a default S32K344 configuration, so we used the first approach.

As for the initialization issue, after checking that the MemAcc component's init sequence was handled properly(as mentioned in the 3 bullets in one of the replies above) and after debugging Rishikesh's project locally, the problem was identified. There was a naming mismatch for the configuration structure used for initializing the MemAcc component. The RTD source file expected a structure named "MemAcc_MBDT_Config", but it was generated as "MemAcc_Config" instead. After this issue was fixed too, the project built and worked as expected.

I am re-stating these explanations in hope that they might prove themselves useful for more users in the future.

Kind regards, 

Florin.

0 Kudos
Reply

1,247 Views
zoozoo9173
Contributor II

@rishikesh_c I am curious if you could share _Config/RTD/src/C40_Ip.c file and Cache_ip.c from the same location of the generated S32DS3.5 project? I have not been able to get S32DS 3.5 example setup and running in the first place. My understnading is that these files are not getting generated from Simulink and hence we have to add these files manually. If I can see the reference example generated files after building, it might provide hints on what needs to be added. Please let me know if you can share this. On the same topic, what did you refer to while instlaling and setting up S32DS3.5 for K344? I would like to get my installation functional as well  

0 Kudos
Reply

1,243 Views
rishikesh_c
Contributor III

Hey @zoozoo9173 , I managed to solve the Cache problem. The issue was that the Mcl peripheral didn't have "Enable Cache Support" enabled which was overwriting the Cache_Ip's equivalent option. After enabling this, the Cache error is gone but it's been replaced with a new error. 

C:/Rishikesh/TC154_Config_MDBT_1.4(4-4-24)/TC154_Config_MDBT_1.4/TC154Config_Config/RTD/src/MemAcc.c:1510:30: error: 'MemAcc_Config' undeclared (first use in this function); did you mean 'MemAcc_Cancel'? 1510 | MemAcc_pConfigPtr = &MemAcc_Config; /* Use pre-compile configuration set structure */ | ^~~~~~~~~~~~~ | MemAcc_Cancel

 

Here are the things I have tried so far: 

1 - In the MemAcc configuration, made sure that the config variant is set to "VARIANT-PRE-COMPILE"
2 - In the board configuration GUI, added a custom component, set the init code to "MemAcc_Init(NULL_PTR);" and header to MemAcc.h
3 - Alternatively, I also used an Initialisation subsystem and used a MATLAB function block to call the MemAcc_Init function. 

But still this error continues. Let me know if you have any success with it

Thanks,
Rishikesh

0 Kudos
Reply

1,175 Views
zoozoo9173
Contributor II

If you have the S32K344 Fee example in RTD300 S32DS3.5 running, would you please share the example folder here in zip? I want to look at the geenrate/include and src folders - specifically memacc pbcfg files. I think S32DS is not generating these files through MBDT and hence we have to copy them over and edit manually - the example files you share might be helpful in understanding this 

0 Kudos
Reply

1,109 Views
rishikesh_c
Contributor III

Hey @zoozoo9173 ,
The pbcg file was indeed the problem. I have managed to get NVM working now. The issue is, you need to change all instances of "MemAcc_MBDT_Config" to "MemAcc_Config". These changes are only in the MemAcc_MBDT_PBCfg header and c files. 

I am posting the solution in a bit. 

Thanks

1,097 Views
zoozoo9173
Contributor II

Great to hear the pbcg files were the issue - Thanks for following my suspicion and trying out the pbcg files. I was trying to work on them last week but without a working example, it was not straightforward to do so. I got mine to work as well this morning. Glad we were able to help each other  

0 Kudos
Reply

1,273 Views
zoozoo9173
Contributor II

Following for solution/updates - I am in the same situation. 

0 Kudos
Reply