MBDT v1.6.0 DataMemRead block and dynamic memory addresses

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

MBDT v1.6.0 DataMemRead block and dynamic memory addresses

Jump to solution
1,007 Views
mariaalejandro
Contributor II

Dear NXP Support Team,

I am working with NXP Model-Based Design Tool (MBDT) v1.6.0 and I have a question regarding the DataMemRead block.

I would like to read data from a memory address that is provided by a variable at runtime (i.e. a dynamic address / pointer). However, the DataMemRead block in my version does not expose any input port for the address; the address can only be configured as a fixed parameter in the block settings.

My questions are:

  1. Is it possible to use the DataMemRead block with a variable (dynamic) address in MBDT v1.6.0?

  2. If not, is this a known limitation of the block?

  3. Is there a recommended or supported alternative within MBDT to perform memory reads using a variable address (e.g. via a specific block or a recommended C Function/User Code approach)?

Any guidance or best practices would be appreciated.

Thank you in advance for your support.

Best regards

0 Kudos
Reply
1 Solution
910 Views
dragostoma
NXP Employee
NXP Employee

Hi, @mariaalejandro,

Since this feature is not yet supported by the toolbox, I’ve outlined below how you can approach the topic using custom code. You can use the s32k3xx_dma_transfer_ebt model example as a starting point for integrating custom code.

1. The first step would be to create a folder containing the .h and .c files, that you will use to create your custom functions. This folder and the corresponding files should be included in the Hardware Settings of the model, at Custom Code section:

- Include directories

dragostoma_0-1770372374430.png

- Source files

dragostoma_1-1770372384067.png

 

2. The next step would be to define these newly created files. 

- dmaBuffers.h will contain the directRAMRead and directRAMWrite function calls:

dragostoma_2-1770372438412.png

- dmaBuffers.c will contain the diretRAMRead and directRAMWrite function definitions:

dragostoma_3-1770372475323.png

 

3. The model example should contain the MATLAB Function block for creating the environment of calling the already created functions.

dragostoma_4-1770372600510.png

dragostoma_5-1770372611848.png

Please note that in the above example was used uint32 as a data type, you should modify this based on your project requirement.

 

4. After building and deploying the code on the hardware, we must validate the model example by importing the generated code into S32 Design Studio IDE. The step function will look like this:

dragostoma_6-1770372785925.png

If you enable the Memory section in the bottom right side in S32DS, you should be able to see the addressed, based on your selected monitors. For example, the 0x20004000 address has been selected, considering the hardware part that the model has been validated on:

dragostoma_7-1770372865339.png

At this section address, a random data has been written. After continuing one step in the debug process, allowing our read function to be executed, the returned result will look like this:

dragostoma_8-1770373001378.png

The difference between the written value (00001234) and the value observed during the memory read (34120000) is a direct consequence of the system’s endianness. The target platform uses little‑endian byte ordering, meaning that multi‑byte values are stored in memory with the least significant byte (LSB) at the lowest address.

So when the logical 32‑bit value 0x00001234 is written, it is placed in memory as:

Byte position Stored byte
Address + 0 0x34
Address + 1 0x12
Address + 2 0x00
Address + 3 0x00

 

When the memory is read back as a 32‑bit word, these bytes are reassembled in the correct order by the CPU, resulting in the displayed value 0x34120000.

This behavior is expected and correct for little‑endian architectures. The model example simply reflects the underlying memory representation, not an error in the input or the tool.

I have also attached the archive containing the model example used in the demonstration.

 

Hope this helps,

Dragos

 

 

View solution in original post

0 Kudos
Reply
4 Replies
957 Views
mariaalejandro
Contributor II

Hello, thank you for the clarification.

To confirm, in our use case the data that needs to be accessed dynamically is stored in RAM, not in Flash. The address is calculated at runtime and must be dereferenced dynamically.

Given that dynamic RAM addressing is not supported by the current Model-Based Design Toolbox implementation, could you please advise:

- What is the recommended workaround for this use case?

- Is the expected approach to use a custom C block / S-Function for dynamic RAM access?

- Are there any roadmap plans to support dynamic RAM addressing in future toolbox releases?

This functionality is required for our application, so any guidance on an NXP-supported or validated solution would be highly appreciated.

Best regards,

0 Kudos
Reply
911 Views
dragostoma
NXP Employee
NXP Employee

Hi, @mariaalejandro,

Since this feature is not yet supported by the toolbox, I’ve outlined below how you can approach the topic using custom code. You can use the s32k3xx_dma_transfer_ebt model example as a starting point for integrating custom code.

1. The first step would be to create a folder containing the .h and .c files, that you will use to create your custom functions. This folder and the corresponding files should be included in the Hardware Settings of the model, at Custom Code section:

- Include directories

dragostoma_0-1770372374430.png

- Source files

dragostoma_1-1770372384067.png

 

2. The next step would be to define these newly created files. 

- dmaBuffers.h will contain the directRAMRead and directRAMWrite function calls:

dragostoma_2-1770372438412.png

- dmaBuffers.c will contain the diretRAMRead and directRAMWrite function definitions:

dragostoma_3-1770372475323.png

 

3. The model example should contain the MATLAB Function block for creating the environment of calling the already created functions.

dragostoma_4-1770372600510.png

dragostoma_5-1770372611848.png

Please note that in the above example was used uint32 as a data type, you should modify this based on your project requirement.

 

4. After building and deploying the code on the hardware, we must validate the model example by importing the generated code into S32 Design Studio IDE. The step function will look like this:

dragostoma_6-1770372785925.png

If you enable the Memory section in the bottom right side in S32DS, you should be able to see the addressed, based on your selected monitors. For example, the 0x20004000 address has been selected, considering the hardware part that the model has been validated on:

dragostoma_7-1770372865339.png

At this section address, a random data has been written. After continuing one step in the debug process, allowing our read function to be executed, the returned result will look like this:

dragostoma_8-1770373001378.png

The difference between the written value (00001234) and the value observed during the memory read (34120000) is a direct consequence of the system’s endianness. The target platform uses little‑endian byte ordering, meaning that multi‑byte values are stored in memory with the least significant byte (LSB) at the lowest address.

So when the logical 32‑bit value 0x00001234 is written, it is placed in memory as:

Byte position Stored byte
Address + 0 0x34
Address + 1 0x12
Address + 2 0x00
Address + 3 0x00

 

When the memory is read back as a 32‑bit word, these bytes are reassembled in the correct order by the CPU, resulting in the displayed value 0x34120000.

This behavior is expected and correct for little‑endian architectures. The model example simply reflects the underlying memory representation, not an error in the input or the tool.

I have also attached the archive containing the model example used in the demonstration.

 

Hope this helps,

Dragos

 

 

0 Kudos
Reply
820 Views
mariaalejandro
Contributor II
This explanation was really useful. Now I',m able to access RAM memory addresses dinamically.
0 Kudos
Reply
966 Views
dragostoma
NXP Employee
NXP Employee

Hi, @mariaalejandro,

Thank you for your interest into Model-Based Design Toolbox for S32K3.

If the data that needs to be accessed dynamically is stored exclusively in RAM, the current version of the block does not provide a solution that supports this use case. Dynamic RAM addressing is not supported by the existing implementation.

If the data is stored in Flash, it can be accessed using the MemInFls Read block, which does allow the use of a dynamic address as its input. The limitation, however, is that the data must already be written to Flash beforehand in order to be selectively accessed (read) at runtime. You can refer to the following model example: s32k3xx_mem_infls_s32ct, where for the Source Address is used a Data Store variable.

 

Best regards,

Dragos

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2305168%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EMBDT%20v1.6.0%20DataMemRead%20block%20and%20dynamic%20memory%20addresses%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2305168%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EDear%20NXP%20Support%20Team%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EI%20am%20working%20with%20NXP%20Model-Based%20Design%20Tool%20(MBDT)%20v1.6.0%20and%20I%20have%20a%20question%20regarding%20the%20DataMemRead%20block.%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EI%20would%20like%20to%20read%20data%20from%20a%20memory%20address%20that%20is%20provided%20by%20a%20variable%20at%20runtime%20(i.e.%20a%20dynamic%20address%20%2F%20pointer).%20However%2C%20the%20DataMemRead%20block%20in%20my%20version%20does%20not%20expose%20any%20input%20port%20for%20the%20address%3B%20the%20address%20can%20only%20be%20configured%20as%20a%20fixed%20parameter%20in%20the%20block%20settings.%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EMy%20questions%20are%3A%3C%2FSPAN%3E%3C%2FP%3E%3COL%3E%3CLI%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EIs%20it%20possible%20to%20use%20the%20DataMemRead%20block%20with%20a%20variable%20(dynamic)%20address%20in%20MBDT%20v1.6.0%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EIf%20not%2C%20is%20this%20a%20known%20limitation%20of%20the%20block%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EIs%20there%20a%20recommended%20or%20supported%20alternative%20within%20MBDT%20to%20perform%20memory%20reads%20using%20a%20variable%20address%20(e.g.%20via%20a%20specific%20block%20or%20a%20recommended%20C%20Function%2FUser%20Code%20approach)%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EAny%20guidance%20or%20best%20practices%20would%20be%20appreciated.%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EThank%20you%20in%20advance%20for%20your%20support.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EBest%20regards%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2305369%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MBDT%20v1.6.0%20DataMemRead%20block%20and%20dynamic%20memory%20addresses%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2305369%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%20thank%20you%20for%20the%20clarification.%3C%2FP%3E%3CP%3ETo%20confirm%2C%20in%20our%20use%20case%20the%20data%20that%20needs%20to%20be%20accessed%20dynamically%20is%20stored%20in%20RAM%2C%20not%20in%20Flash.%20The%20address%20is%20calculated%20at%20runtime%20and%20must%20be%20dereferenced%20dynamically.%3C%2FP%3E%3CP%3EGiven%20that%20dynamic%20RAM%20addressing%20is%20not%20supported%20by%20the%20current%20Model-Based%20Design%20Toolbox%20implementation%2C%20could%20you%20please%20advise%3A%3C%2FP%3E%3CP%3E-%20What%20is%20the%20%3CSTRONG%3Erecommended%20workaround%3C%2FSTRONG%3E%20for%20this%20use%20case%3F%3C%2FP%3E%3CP%3E-%20Is%20the%20expected%20approach%20to%20use%20a%20%3CSTRONG%3Ecustom%20C%20block%20%2F%20S-Function%3C%2FSTRONG%3E%20for%20dynamic%20RAM%20access%3F%3C%2FP%3E%3CP%3E-%20Are%20there%20any%20roadmap%20plans%20to%20support%20dynamic%20RAM%20addressing%20in%20future%20toolbox%20releases%3F%3C%2FP%3E%3CP%3EThis%20functionality%20is%20required%20for%20our%20application%2C%20so%20any%20guidance%20on%20an%20NXP-supported%20or%20validated%20solution%20would%20be%20highly%20appreciated.%3C%2FP%3E%3CP%3EBest%20regards%2C%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2305361%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MBDT%20v1.6.0%20DataMemRead%20block%20and%20dynamic%20memory%20addresses%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2305361%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F243169%22%20target%3D%22_blank%22%3E%40mariaalejandro%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EThank%20you%20for%20your%20interest%20into%20Model-Based%20Design%20Toolbox%20for%20S32K3.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EIf%20the%20data%20that%20needs%20to%20be%20accessed%20dynamically%20is%20stored%20%3CSTRONG%3Eexclusively%20in%20RAM%3C%2FSTRONG%3E%2C%20the%20current%20version%20of%20the%20block%20does%20not%20provide%20a%20solution%20that%20supports%20this%20use%20case.%20Dynamic%20RAM%20addressing%20is%20not%20supported%20by%20the%20existing%20implementation.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EIf%20the%20data%20is%20stored%20in%20%3CSTRONG%3EFlash%3C%2FSTRONG%3E%2C%20it%20can%20be%20accessed%20using%20the%20%3CSTRONG%3EMemInFls%20Read%3C%2FSTRONG%3E%20block%2C%20which%20does%20allow%20the%20use%20of%20a%20dynamic%20address%20as%20its%20input.%20The%20limitation%2C%20however%2C%20is%20that%20the%20data%20must%20already%20be%20written%20to%20Flash%20beforehand%20in%20order%20to%20be%20selectively%20accessed%20(read)%20at%20runtime.%20You%20can%20refer%20to%20the%20following%20model%20example%3A%26nbsp%3B%3CEM%3E%3CSTRONG%3Es32k3xx_mem_infls_s32ct%2C%26nbsp%3B%3C%2FSTRONG%3E%3C%2FEM%3Ewhere%20for%20the%20Source%20Address%20is%20used%20a%20Data%20Store%20variable.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSPAN%3EBest%20regards%2C%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EDragos%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2313677%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MBDT%20v1.6.0%20DataMemRead%20block%20and%20dynamic%20memory%20addresses%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2313677%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F243169%22%20target%3D%22_blank%22%3E%40mariaalejandro%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3ESince%20this%20feature%20is%20not%20yet%20supported%20by%20the%20toolbox%2C%20I%E2%80%99ve%20outlined%20below%20how%20you%20can%20approach%20the%20topic%20using%20custom%20code.%20You%20can%20use%20the%20%3CCODE%3Es32k3xx_dma_transfer_ebt%3C%2FCODE%3E%20model%20example%20as%20a%20starting%20point%20for%20integrating%20custom%20code.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E1.%20%3C%2FSTRONG%3EThe%20first%20step%20would%20be%20to%20create%20a%20folder%20containing%20the%20.h%20and%20.c%20files%2C%20that%20you%20will%20use%20to%20create%20your%20custom%20functions.%20This%20folder%20and%20the%20corresponding%20files%20should%20be%20included%20in%20the%20%3CSTRONG%3EHardware%20Settings%3C%2FSTRONG%3E%20of%20the%20model%2C%20at%20%3CSTRONG%3ECustom%20Code%3C%2FSTRONG%3E%20section%3A%3C%2FP%3E%0A%3CP%3E-%20Include%20directories%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22dragostoma_0-1770372374430.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dragostoma_0-1770372374430.png%22%20style%3D%22width%3A%20323px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dragostoma_0-1770372374430.png%22%20style%3D%22width%3A%20323px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F375830i80C00F86C0E76988%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22dragostoma_0-1770372374430.png%22%20alt%3D%22dragostoma_0-1770372374430.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E-%20Source%20files%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22dragostoma_1-1770372384067.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dragostoma_1-1770372384067.png%22%20style%3D%22width%3A%20282px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dragostoma_1-1770372384067.png%22%20style%3D%22width%3A%20282px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F375831iF8A493FF9DAB1C62%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22dragostoma_1-1770372384067.png%22%20alt%3D%22dragostoma_1-1770372384067.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSTRONG%3E2.%3C%2FSTRONG%3E%20The%20next%20step%20would%20be%20to%20define%20these%20newly%20created%20files.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E-%20%3CSTRONG%3EdmaBuffers.h%3C%2FSTRONG%3E%20will%20contain%20the%20%3CSTRONG%3EdirectRAMRead%3C%2FSTRONG%3E%26nbsp%3Band%20%3CSTRONG%3EdirectRAMWrite%26nbsp%3B%3C%2FSTRONG%3Efunction%20calls%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22dragostoma_2-1770372438412.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dragostoma_2-1770372438412.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dragostoma_2-1770372438412.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F375832i281E0051583A3D3E%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22dragostoma_2-1770372438412.png%22%20alt%3D%22dragostoma_2-1770372438412.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E-%20%3CSTRONG%3EdmaBuffers.c%3C%2FSTRONG%3E%20will%20contain%20the%20%3CSTRONG%3EdiretRAMRead%3C%2FSTRONG%3E%20and%20%3CSTRONG%3EdirectRAMWrite%3C%2FSTRONG%3E%20function%20definitions%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22dragostoma_3-1770372475323.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dragostoma_3-1770372475323.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dragostoma_3-1770372475323.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F375833iD81CA573B444184E%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22dragostoma_3-1770372475323.png%22%20alt%3D%22dragostoma_3-1770372475323.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSTRONG%3E3.%3C%2FSTRONG%3E%20The%20model%20example%20should%20contain%20the%20%3CSTRONG%3EMATLAB%20Function%3C%2FSTRONG%3E%20block%20for%20creating%20the%20environment%20of%20calling%20the%20already%20created%20functions.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22dragostoma_4-1770372600510.png%22%20style%3D%22width%3A%20626px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dragostoma_4-1770372600510.png%22%20style%3D%22width%3A%20626px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dragostoma_4-1770372600510.png%22%20style%3D%22width%3A%20626px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F375834i878E76135B5C146C%2Fimage-dimensions%2F626x191%3Fv%3Dv2%22%20width%3D%22626%22%20height%3D%22191%22%20role%3D%22button%22%20title%3D%22dragostoma_4-1770372600510.png%22%20alt%3D%22dragostoma_4-1770372600510.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22dragostoma_5-1770372611848.png%22%20style%3D%22width%3A%20485px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dragostoma_5-1770372611848.png%22%20style%3D%22width%3A%20485px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dragostoma_5-1770372611848.png%22%20style%3D%22width%3A%20485px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F375835i475AEE795A017ED9%2Fimage-dimensions%2F485x212%3Fv%3Dv2%22%20width%3D%22485%22%20height%3D%22212%22%20role%3D%22button%22%20title%3D%22dragostoma_5-1770372611848.png%22%20alt%3D%22dragostoma_5-1770372611848.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EPlease%20note%20that%20in%20the%20above%20example%20was%20used%20%3CSTRONG%3Euint32%3C%2FSTRONG%3E%20as%20a%20data%20type%2C%20you%20should%20modify%20this%20based%20on%20your%20project%20requirement.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSTRONG%3E4.%3C%2FSTRONG%3E%20After%20building%20and%20deploying%20the%20code%20on%20the%20hardware%2C%20we%20must%20validate%20the%20model%20example%20by%20importing%20the%20generated%20code%20into%20%3CSTRONG%3ES32%20Design%20Studio%20IDE%3C%2FSTRONG%3E.%20The%20step%20function%20will%20look%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22dragostoma_6-1770372785925.png%22%20style%3D%22width%3A%20443px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dragostoma_6-1770372785925.png%22%20style%3D%22width%3A%20443px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dragostoma_6-1770372785925.png%22%20style%3D%22width%3A%20443px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F375836iEB26A5E93A89B6B0%2Fimage-dimensions%2F443x156%3Fv%3Dv2%22%20width%3D%22443%22%20height%3D%22156%22%20role%3D%22button%22%20title%3D%22dragostoma_6-1770372785925.png%22%20alt%3D%22dragostoma_6-1770372785925.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EIf%20you%20enable%20the%20%3CSTRONG%3EMemory%3C%2FSTRONG%3E%20section%20in%20the%20bottom%20right%20side%20in%20S32DS%2C%20you%20should%20be%20able%20to%20see%20the%20addressed%2C%20based%20on%20your%20selected%20monitors.%20For%20example%2C%20the%20%3CSTRONG%3E0x20004000%3C%2FSTRONG%3E%20address%20has%20been%20selected%2C%20considering%20the%20hardware%20part%20that%20the%20model%20has%20been%20validated%20on%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22dragostoma_7-1770372865339.png%22%20style%3D%22width%3A%20664px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dragostoma_7-1770372865339.png%22%20style%3D%22width%3A%20664px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dragostoma_7-1770372865339.png%22%20style%3D%22width%3A%20664px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F375837iA525B69A25A4D35F%2Fimage-dimensions%2F664x500%3Fv%3Dv2%22%20width%3D%22664%22%20height%3D%22500%22%20role%3D%22button%22%20title%3D%22dragostoma_7-1770372865339.png%22%20alt%3D%22dragostoma_7-1770372865339.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAt%20this%20section%20address%2C%20a%20random%20data%20has%20been%20written.%20After%20continuing%20one%20step%20in%20the%20debug%20process%2C%20allowing%20our%20read%20function%20to%20be%20executed%2C%20the%20returned%20result%20will%20look%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22dragostoma_8-1770373001378.png%22%20style%3D%22width%3A%20660px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dragostoma_8-1770373001378.png%22%20style%3D%22width%3A%20660px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dragostoma_8-1770373001378.png%22%20style%3D%22width%3A%20660px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F375838iE17948F4562DD386%2Fimage-dimensions%2F660x302%3Fv%3Dv2%22%20width%3D%22660%22%20height%3D%22302%22%20role%3D%22button%22%20title%3D%22dragostoma_8-1770373001378.png%22%20alt%3D%22dragostoma_8-1770373001378.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThe%20difference%20between%20the%20written%20value%20(%3CCODE%3E00001234%3C%2FCODE%3E)%20and%20the%20value%20observed%20during%20the%20memory%20read%20(%3CCODE%3E34120000%3C%2FCODE%3E)%20is%20a%20direct%20consequence%20of%20the%20system%E2%80%99s%20%3CSTRONG%3Eendianness%3C%2FSTRONG%3E.%20The%20target%20platform%20uses%20%3CSTRONG%3Elittle%E2%80%91endian%3C%2FSTRONG%3E%20byte%20ordering%2C%20meaning%20that%20multi%E2%80%91byte%20values%20are%20stored%20in%20memory%20with%20the%20%3CSTRONG%3Eleast%20significant%20byte%20(LSB)%20at%20the%20lowest%20address%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ESo%20when%20the%20logical%2032%E2%80%91bit%20value%20%3CCODE%3E0x00001234%3C%2FCODE%3E%20is%20written%2C%20it%20is%20placed%20in%20memory%20as%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CDIV%3E%0A%3CDIV%3E%0A%3CTABLE%3E%0A%3CTHEAD%3E%0A%3CTR%3E%0A%3CTH%3E%3CSPAN%3EByte%20%3C%2FSPAN%3E%3CSPAN%3Eposition%3C%2FSPAN%3E%3C%2FTH%3E%0A%3CTH%3E%3CSPAN%3EStored%20%3C%2FSPAN%3E%3CSPAN%3Ebyte%3C%2FSPAN%3E%3C%2FTH%3E%0A%3C%2FTR%3E%0A%3C%2FTHEAD%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%3E%3CSPAN%3EAddress%20%3C%2FSPAN%3E%3CSPAN%3E%2B%20%3C%2FSPAN%3E%3CSPAN%3E0%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%3E%3CCODE%3E%3CSPAN%3E0x34%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CSPAN%3EAddress%20%3C%2FSPAN%3E%3CSPAN%3E%2B%20%3C%2FSPAN%3E%3CSPAN%3E1%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%3E%3CCODE%3E%3CSPAN%3E0x12%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CSPAN%3EAddress%20%3C%2FSPAN%3E%3CSPAN%3E%2B%20%3C%2FSPAN%3E%3CSPAN%3E2%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%3E%3CCODE%3E%3CSPAN%3E0x00%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CSPAN%3EAddress%20%3C%2FSPAN%3E%3CSPAN%3E%2B%20%3C%2FSPAN%3E%3CSPAN%3E3%3C%2FSPAN%3E%3C%2FTD%3E%0A%3CTD%3E%3CCODE%3E%3CSPAN%3E0x00%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSPAN%3EWhen%20the%20memory%20is%20read%20back%20as%20a%2032%E2%80%91bit%20word%2C%20these%20bytes%20are%20reassembled%20in%20the%20correct%20order%20by%20the%20CPU%2C%20resulting%20in%20the%20displayed%20value%20%3CCODE%3E0x34120000%3C%2FCODE%3E.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EThis%20behavior%20is%20%3CSTRONG%3Eexpected%20and%20correct%3C%2FSTRONG%3E%20for%20little%E2%80%91endian%20architectures.%20The%20model%20example%20simply%20reflects%20the%20underlying%20memory%20representation%2C%20not%20an%20error%20in%20the%20input%20or%20the%20tool.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EI%20have%20also%20attached%20the%20archive%20containing%20the%20model%20example%20used%20in%20the%20demonstration.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSPAN%3EHope%20this%20helps%2C%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EDragos%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CBR%20%2F%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2315294%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MBDT%20v1.6.0%20DataMemRead%20block%20and%20dynamic%20memory%20addresses%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2315294%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EThis%20explanation%20was%20really%20useful.%20Now%20I'%2Cm%20able%20to%20access%20RAM%20memory%20addresses%20dinamically.%3C%2FLINGO-BODY%3E