How to Place Custom Data into SRAM for S32K146 Using S32 Design Studio for ARM?

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

How to Place Custom Data into SRAM for S32K146 Using S32 Design Studio for ARM?

Jump to solution
1,331 Views
Chandler_L
Contributor II
Hi NXP Support Team: I am currently working on a project using the S32K146 microcontroller and the S32 Design Studio for ARM development environment. I would like to place custom data into SRAM for my application but am unsure of the correct procedure to achieve this. I would appreciate any documentation, examples, or instructions that could help me implement this in my project. Thank you for your time and assistance. I look forward to your response. #S32K
0 Kudos
Reply
1 Solution
1,314 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@LaiBighead

Please refero to this post, you can use "attribute" to place data to specific address.

https://community.nxp.com/t5/S32-Design-Studio/How-can-S32K-define-a-variable-in-a-specified-address...

 

View solution in original post

0 Kudos
Reply
3 Replies
1,315 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@LaiBighead

Please refero to this post, you can use "attribute" to place data to specific address.

https://community.nxp.com/t5/S32-Design-Studio/How-can-S32K-define-a-variable-in-a-specified-address...

 

0 Kudos
Reply
1,303 Views
Chandler_L
Contributor II

Hi@LSenlent :

I appreciate your help,  I have defined a memory region in the linker script with a length of 4 bytes as shown below:

oem_ram (RW) : ORIGIN = 0x20002A0A, LENGTH = 0x00000004 

._oem_ram :
{
KEEP(*(._oem_ram ))
} > oem_ram

In (.c) file

uint8_t DID_F183_PRO_CODE[4] __attribute__((section(".oem_did_data_ram_area2"))) = { 0xFF, 0xFF, 0xFF, 0xFF };

However, I am receiving the following error during the build process:

Ld error: region `oem_ram' overflowed by 2 bytes

ECU_APP_DemoProject.elf section `._oem_ram ' will not fit in region `oem_ram' 

This suggests that the data segment's actual size exceeds the allocated 4-byte region, causing an overflow. I am unable to understand the exact reason for this overflow, as the data I have defined is just 4 bytes in size.

Could you please help me understand why this overflow is happening and what might be causing the data size to exceed the allocated 4 bytes?

 

I have a question regarding operations in the .id file. Specifically, I would like to know how to copy a custom Flash data segment to SRAM during startup in the S32K146 environment, using S32Studio for ARM.

In other development environments (such as CodeWarrior), I am familiar with the syntax:

cal_flash:             org = 0x00009000,   len = 0x00002000

cal_ram:              org = 0x40001000, len = 0x00001800

_cal_ram LOAD(ADDR(cal_flash)): {} > cal_ram

Could you please guide me on how to implement this operation in S32K146 using S32Studio for ARM?

 

0 Kudos
Reply
1,265 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@Chandler_L

I have told you how to put data in a specified RAM space.

For more syntax rules, please Google it.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2047717%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHow%20to%20Place%20Custom%20Data%20into%20SRAM%20for%20S32K146%20Using%20S32%20Design%20Studio%20for%20ARM%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2047717%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHi%20NXP%20Support%20Team%3A%20I%20am%20currently%20working%20on%20a%20project%20using%20the%20S32K146%20microcontroller%20and%20the%20S32%20Design%20Studio%20for%20ARM%20development%20environment.%20I%20would%20like%20to%20place%20custom%20data%20into%20SRAM%20for%20my%20application%20but%20am%20unsure%20of%20the%20correct%20procedure%20to%20achieve%20this.%20I%20would%20appreciate%20any%20documentation%2C%20examples%2C%20or%20instructions%20that%20could%20help%20me%20implement%20this%20in%20my%20project.%20Thank%20you%20for%20your%20time%20and%20assistance.%20I%20look%20forward%20to%20your%20response.%20%23S32K%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2049512%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20How%20to%20Place%20Custom%20Data%20into%20SRAM%20for%20S32K146%20Using%20S32%20Design%20Studio%20for%20ARM%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2049512%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%40%3CSPAN%3EChandler_L%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EI%20have%20told%20you%20how%20to%20put%20data%20in%20a%20specified%20RAM%20space.%3C%2FP%3E%0A%3CP%3EFor%20more%20syntax%20rules%2C%20please%20Google%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2048818%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20How%20to%20Place%20Custom%20Data%20into%20SRAM%20for%20S32K146%20Using%20S32%20Design%20Studio%20for%20ARM%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2048818%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%3CSPAN%3E%40%3C%2FSPAN%3E%3CSPAN%3EL%3C%2FSPAN%3ESenlent%20%3A%3C%2FP%3E%3CP%3EI%20appreciate%20your%20help%2C%26nbsp%3B%20I%20have%20defined%20a%20memory%20region%20in%20the%20linker%20script%20with%20a%20length%20of%204%20bytes%20as%20shown%20below%3A%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23FF0000%22%3Eoem_ram%20(RW)%20%3A%20ORIGIN%20%3D%200x20002A0A%2C%20LENGTH%20%3D%200x00000004%26nbsp%3B%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23FF0000%22%3E._oem_ram%20%3A%3CBR%20%2F%3E%7B%3CBR%20%2F%3EKEEP(*(._oem_ram%20))%3CBR%20%2F%3E%7D%20%26gt%3B%20oem_ram%20%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23000000%22%3EIn%20(.c)%20file%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23FF0000%22%3E%3CSPAN%20class%3D%22%22%3Euint8_t%3C%2FSPAN%3E%20DID_F183_PRO_CODE%5B4%5D%20__attribute__((section(%3CSPAN%20class%3D%22%22%3E%22.oem_did_data_ram_area2%22%3C%2FSPAN%3E)))%20%3D%20%7B%20%3CSPAN%20class%3D%22%22%3E0xFF%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22%22%3E0xFF%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22%22%3E0xFF%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22%22%3E0xFF%3C%2FSPAN%3E%20%7D%3B%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23000000%22%3EHowever%2C%20I%20am%20receiving%20the%20following%20error%20during%20the%20build%20process%3A%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23FF0000%22%3ELd%20error%3A%20region%20%60oem_ram'%20overflowed%20by%202%20bytes%3CBR%20%2F%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23000000%22%3E%3CFONT%20color%3D%22%23FF0000%22%3EECU_APP_DemoProject.elf%20section%20%60._oem_ram%20'%20will%20not%20fit%20in%20region%20%60oem_ram'%26nbsp%3B%3C%2FFONT%3E%3CBR%20%2F%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23000000%22%3EThis%20suggests%20that%20the%20data%20segment's%20actual%20size%20exceeds%20the%20allocated%204-byte%20region%2C%20causing%20an%20overflow.%20I%20am%20unable%20to%20understand%20the%20exact%20reason%20for%20this%20overflow%2C%20as%20the%20data%20I%20have%20defined%20is%20just%204%20bytes%20in%20size.%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23000000%22%3ECould%20you%20please%20help%20me%20understand%20why%20this%20overflow%20is%20happening%20and%20what%20might%20be%20causing%20the%20data%20size%20to%20exceed%20the%20allocated%204%20bytes%3F%3C%2FFONT%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EI%20have%20a%20question%20regarding%20operations%20in%20the%20.id%20file.%20Specifically%2C%20I%20would%20like%20to%20know%20how%20to%20%3CFONT%20color%3D%22%23FF0000%22%3Ecopy%20a%20custom%20Flash%20data%20segment%20to%20SRAM%3C%2FFONT%3E%20during%20startup%20in%20the%20S32K146%20environment%2C%20using%20S32Studio%20for%20ARM.%3C%2FP%3E%3CP%3EIn%20other%20development%20environments%20(such%20as%20CodeWarrior)%2C%20I%20am%20familiar%20with%20the%20syntax%3A%3C%2FP%3E%3CP%3E%3CSPAN%3Ecal_flash%3A%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3Borg%20%3D%200x00009000%2C%26nbsp%3B%20%26nbsp%3Blen%20%3D%200x00002000%3C%2FSPAN%3E%3C%2FP%3E%3CP%3Ecal_ram%3A%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20org%20%3D%200x40001000%2C%20len%20%3D%200x00001800%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23000000%22%3E_cal_ram%20LOAD(ADDR(cal_flash))%3A%20%7B%7D%20%26gt%3B%20cal_ram%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23000000%22%3ECould%20you%20please%20guide%20me%20on%20how%20to%20implement%20this%20operation%20in%20S32K146%20using%20S32Studio%20for%20ARM%3F%3C%2FFONT%3E%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2047997%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20How%20to%20Place%20Custom%20Data%20into%20SRAM%20for%20S32K146%20Using%20S32%20Design%20Studio%20for%20ARM%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2047997%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%40%3CSPAN%3ELaiBighead%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EPlease%20refero%20to%20this%20post%2C%20you%20can%20use%20%22attribute%22%20to%20place%20data%20to%20specific%20address.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32-Design-Studio%2FHow-can-S32K-define-a-variable-in-a-specified-address%2Fm-p%2F731255%2Fhighlight%2Ftrue%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32-Design-Studio%2FHow-can-S32K-define-a-variable-in-a-specified-address%2Fm-p%2F731255%2Fhighlight%2Ftrue%3C%2FA%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E