S32K358 C++ project based on S32DS3.5

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

S32K358 C++ project based on S32DS3.5

1,027 Views
CherryDeng
Contributor I

We use RTD50.0 and want to integrate C++ code into S32DS3.5. Do you have a C++project based on S32K3? Thank you.

0 Kudos
Reply
2 Replies

982 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

We do not have C++ based project.

But RTD is written is such way that it should be used with C++ code.

You have to define it in macro __cplusplus.

But I have never tied it.

Best regards,

Peter

0 Kudos
Reply

775 Views
peter_pinewski
NXP Employee
NXP Employee

Hi @petervlna , @CherryDeng ,

Please see the attached for a simple cpp and S32K358 RTD3.0.0 example. (based on a single core)

Note...in order to use the RTD with a c++ program, a few things need to be considered.

  1. 1 - correct include paths in the project which include paths to the RTD 
  2. 2 - modified linker file to include c++ requirements (i.e crt0.o and constructor definitiions)
  3. 3 - modified startup to include both RTD and c++ requirements.

 

In the attached S32K358 example, the steps to get it working were:

1 - Start with an RTD example.

2 - Convert RTD example to c++ by selecting File/New/Convert to a C/C++ Project

3 - Modify linker file to include c++ requirements. (refer to attached linker file)

4 - Modify RTD startup_cm7.s by changing the Reset_Handler entry name to _start_RTD (needed to avoid redundant definitioin of _start from RTD and C++)

 

peter_pinewski_2-1741615978444.png

5. Change the bl main to bl _start to jump to the c++ _start files.  (this is defined incrt0.o) 

peter_pinewski_3-1741615987104.png

 

The attached project is a very simple PIT interrupt example but may be a good place to start.

Regards,

Peter

 

 

0 Kudos
Reply