<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Gcc ignoring pragma statements to place code into ITCM memory. in Model-Based Design Toolbox (MBDT)</title>
    <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Gcc-ignoring-pragma-statements-to-place-code-into-ITCM-memory/m-p/2404585#M10798</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;Please check the following page on MathWorks website how to set up a custom storage class.:&amp;nbsp;&lt;A href="https://www.mathworks.com/help/ecoder/ug/control-data-and-function-placement-in-memory-by-inserting-pragmas.html#mw_2cafc0af-c99b-4336-84bd-ae46168dd01f" target="_blank" rel="noopener"&gt;Control Data and Function Placement in Memory by Inserting Pragmas.&lt;/A&gt;&lt;BR /&gt;The part that you need to use is "Override Default Memory Placement for Subsystem Functions and Data".&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_0-1786627722302.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394557iDF6DC155469603E8/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_0-1786627722302.png" alt="SorinIBancila_0-1786627722302.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;After you created you custom storage class, you must configure the model to load it:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;0. Create and configure the custom storage class:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_5-1786628332348.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394565i955F51145FD2B085/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_5-1786628332348.png" alt="SorinIBancila_5-1786628332348.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;1. Enter Code Perspective&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_1-1786628013296.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394559iF731C26A35D132D5/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_1-1786628013296.png" alt="SorinIBancila_1-1786628013296.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Open Embedded Coder DIctionary (Model)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_2-1786628097732.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394560i8662B0A5242070B5/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_2-1786628097732.png" alt="SorinIBancila_2-1786628097732.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. Load the custom class you previously created.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_3-1786628212316.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394561i3CFC7F7D5B8DAA32/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_3-1786628212316.png" alt="SorinIBancila_3-1786628212316.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;4. Inside the model, create a new Subsystem and set it to atomic.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_6-1786628433580.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394566i134E0B0E9B0A9147/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_6-1786628433580.png" alt="SorinIBancila_6-1786628433580.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;5.&amp;nbsp; Inside the Code Generation, set the Memory section for execution functions: "MemSection_ITCM" as set in the custom class.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_7-1786628826071.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394567i2E5D62D40F440FAB/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_7-1786628826071.png" alt="SorinIBancila_7-1786628826071.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;6.&amp;nbsp; arm-none-eabi-objdump properly repots that ITCM_ToggleDIO.o is loaded into the .itcm_text memory section&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_8-1786631977524.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394569i4F159709A2060278/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_8-1786631977524.png" alt="SorinIBancila_8-1786631977524.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;arm-none-eabi-nm -n s32k3xx_dio_s32ct.elf also says that ITCM_ToggleDIO is found at&amp;nbsp; 0x0 address.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_9-1786632086079.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394570i9E483F829B1A8FFA/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_9-1786632086079.png" alt="SorinIBancila_9-1786632086079.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;If the .elf is flashed from the S32DS and a breakpoint is used inside the&amp;nbsp;&lt;SPAN&gt;s32k3xx_dio_s32c_ITCM_ToggleDIO function., in the disassembly view we can see that the instructions are stored starting at 0x0 address.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_0-1786632484317.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394571i8ABCF986BC4C2B9E/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_0-1786632484317.png" alt="SorinIBancila_0-1786632484317.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Sorin Bancila&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Aug 2026 14:48:17 GMT</pubDate>
    <dc:creator>SorinIBancila</dc:creator>
    <dc:date>2026-08-13T14:48:17Z</dc:date>
    <item>
      <title>Gcc ignoring pragma statements to place code into ITCM memory.</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Gcc-ignoring-pragma-statements-to-place-code-into-ITCM-memory/m-p/2404463#M10797</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;Using Matlab R2025b, Simulink and MBDT for S32K3 version 1.7.1 here.&lt;/P&gt;&lt;P&gt;To optimize the performance of a motor controller application we are developing we want to place some parts of the code into the ITCM memory and later on, DTCM memory for data.&lt;/P&gt;&lt;P&gt;As for now, for testing the workflow, I am trying to get a function placed into ITCM memory. I managed to get Simulink/ embedded coder to place the correct pragma statements in to the c code like:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#pragma GCC section text ".itcm_text"&lt;BR /&gt;&lt;/EM&gt;&lt;EM&gt;static void&amp;nbsp; Motor_Drive_Subsystem(void)&lt;BR /&gt;&lt;/EM&gt;&lt;EM&gt;{&lt;BR /&gt;..........&lt;BR /&gt;}&lt;BR /&gt;&lt;/EM&gt;&lt;EM&gt;#pragma GCC section text ""&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;However, when compiling the application gcc ignore these pragma statements and places the code in the standard .text segment. This can be concluded with The objdump command:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;arm-none-eabi-objdump -h Motor_Control.o&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/EM&gt;(beeing the .o file generated from the c-file containing the Motor_Drive_Subsystem function)&lt;/P&gt;&lt;P&gt;There are no .itcm_text in the list just .text.xxxx segments (among the other non text segments).&lt;/P&gt;&lt;P&gt;When compiling I use the standard switches for gcc set by the MBDT environment:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;arm-none-eabi-gcc -O2 -c -std=c99 -fshort-enums -funsigned-char -fstack-usage -ffunction-sections -fdata-sections -g -pedantic -Wall -Wextra -fmessage-length=0 -funsigned-bitfields -fno-common -Wunused -Wstrict-prototypes -Wsign-compare -Werror=implicit-function-declaration -mcpu=cortex-m7 -mthumb -mlittle-endian -mfloat-abi=hard -mfpu=fpv5-sp-d16 -DD_CACHE_ENABLE -DI_CACHE_ENABLE -specs=nano.specs -specs=nosys.specs --sysroot="C:\MATLAB_Add-Ons\Toolboxes\NXP_MBDToolbox_S32K3\tools\build_tools\gcc_v10.2\gcc-10.2-arm32-eabi\arm-none-eabi\newlib" -DSTEP_GPT_TIMER -DSTEP_GPT_CHANNEL=GptConf_GptChannelConfiguration_StepTimer -DSTEP_GPT_CHANNEL_FREQ=40000000 -DSTEP_GPT_CHANNEL_VALUE_MAX=4294967295 -DAUTOSAR_OS_NOT_USED -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DGCC -DS32K3XX -DS32K396 -DCPU_S32K396 -DENABLE_FPU -DMPU_ENABLE -DMBDT_INIT -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTERMFCN=0 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0&amp;nbsp; -DTID01EQ=0 -DSTACK_SIZE=64 -DRT -DMODEL=Motor_Control -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IC: ..... &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;By modifying the generated c code file and manually compiling it I can conclude the following:&lt;/P&gt;&lt;P&gt;Removing the “static” declaration of the function does not help. However, removing “static” and using the alternative way for this by adding an attribute statement on the function:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;static void&amp;nbsp; __attribute__((section(".itcm_text")))Motor_Drive_Subsystem(void);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;will create a .itcm_text segment in the .o file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not sure if I am doing something wrong here or if it is a tool problem.&lt;/P&gt;&lt;P&gt;Can someone guide me on how to get this working?&lt;/P&gt;&lt;P&gt;Of course, we want the tool chain to handle this and do not want to manually modify the c code after code generation.&lt;/P&gt;&lt;P&gt;As far as I can see it looks like the startup_cm7.s and linker_flash_s32k396.ld files are prepared for handling the ITCM and DTCM memories.&lt;/P&gt;&lt;P&gt;I found this post in the forum, not sure if it is relevant for this: &lt;A href="https://community.nxp.com/t5/S32-Design-Studio/No-GCC-11-4-item-in-new-project-wizard-dialog-on-S32DS-3-6-2/td-p/2134523" target="_blank"&gt;https://community.nxp.com/t5/S32-Design-Studio/No-GCC-11-4-item-in-new-project-wizard-dialog-on-S32DS-3-6-2/td-p/2134523&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The MBDT gcc seems to be build 1728 where as the fixed one in the post is build 1803.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2026 08:17:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Gcc-ignoring-pragma-statements-to-place-code-into-ITCM-memory/m-p/2404463#M10797</guid>
      <dc:creator>RNJ</dc:creator>
      <dc:date>2026-08-13T08:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: Gcc ignoring pragma statements to place code into ITCM memory.</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Gcc-ignoring-pragma-statements-to-place-code-into-ITCM-memory/m-p/2404585#M10798</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;Please check the following page on MathWorks website how to set up a custom storage class.:&amp;nbsp;&lt;A href="https://www.mathworks.com/help/ecoder/ug/control-data-and-function-placement-in-memory-by-inserting-pragmas.html#mw_2cafc0af-c99b-4336-84bd-ae46168dd01f" target="_blank" rel="noopener"&gt;Control Data and Function Placement in Memory by Inserting Pragmas.&lt;/A&gt;&lt;BR /&gt;The part that you need to use is "Override Default Memory Placement for Subsystem Functions and Data".&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_0-1786627722302.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394557iDF6DC155469603E8/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_0-1786627722302.png" alt="SorinIBancila_0-1786627722302.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;After you created you custom storage class, you must configure the model to load it:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;0. Create and configure the custom storage class:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_5-1786628332348.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394565i955F51145FD2B085/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_5-1786628332348.png" alt="SorinIBancila_5-1786628332348.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;1. Enter Code Perspective&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_1-1786628013296.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394559iF731C26A35D132D5/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_1-1786628013296.png" alt="SorinIBancila_1-1786628013296.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Open Embedded Coder DIctionary (Model)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_2-1786628097732.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394560i8662B0A5242070B5/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_2-1786628097732.png" alt="SorinIBancila_2-1786628097732.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. Load the custom class you previously created.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_3-1786628212316.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394561i3CFC7F7D5B8DAA32/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_3-1786628212316.png" alt="SorinIBancila_3-1786628212316.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;4. Inside the model, create a new Subsystem and set it to atomic.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_6-1786628433580.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394566i134E0B0E9B0A9147/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_6-1786628433580.png" alt="SorinIBancila_6-1786628433580.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;5.&amp;nbsp; Inside the Code Generation, set the Memory section for execution functions: "MemSection_ITCM" as set in the custom class.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_7-1786628826071.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394567i2E5D62D40F440FAB/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_7-1786628826071.png" alt="SorinIBancila_7-1786628826071.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;6.&amp;nbsp; arm-none-eabi-objdump properly repots that ITCM_ToggleDIO.o is loaded into the .itcm_text memory section&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_8-1786631977524.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394569i4F159709A2060278/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_8-1786631977524.png" alt="SorinIBancila_8-1786631977524.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;arm-none-eabi-nm -n s32k3xx_dio_s32ct.elf also says that ITCM_ToggleDIO is found at&amp;nbsp; 0x0 address.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_9-1786632086079.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394570i9E483F829B1A8FFA/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_9-1786632086079.png" alt="SorinIBancila_9-1786632086079.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;If the .elf is flashed from the S32DS and a breakpoint is used inside the&amp;nbsp;&lt;SPAN&gt;s32k3xx_dio_s32c_ITCM_ToggleDIO function., in the disassembly view we can see that the instructions are stored starting at 0x0 address.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SorinIBancila_0-1786632484317.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394571i8ABCF986BC4C2B9E/image-size/large?v=v2&amp;amp;px=999" role="button" title="SorinIBancila_0-1786632484317.png" alt="SorinIBancila_0-1786632484317.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Sorin Bancila&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2026 14:48:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Gcc-ignoring-pragma-statements-to-place-code-into-ITCM-memory/m-p/2404585#M10798</guid>
      <dc:creator>SorinIBancila</dc:creator>
      <dc:date>2026-08-13T14:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Gcc ignoring pragma statements to place code into ITCM memory.</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Gcc-ignoring-pragma-statements-to-place-code-into-ITCM-memory/m-p/2405278#M10799</link>
      <description>&lt;P&gt;Hi Sorin&lt;/P&gt;&lt;P&gt;Thanks for helping out!&lt;/P&gt;&lt;P&gt;I was actually following those instructions at Mathworks web site.&lt;/P&gt;&lt;P&gt;Now I have the insertion of attribute statements instead of pragma statements working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But still, gcc refuses to put the function into the .itcm_text segment.&lt;/P&gt;&lt;P&gt;I use these code generation settings for the block:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RNJ_0-1786705067074.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394643i404B76887A0F4090/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RNJ_0-1786705067074.png" alt="RNJ_0-1786705067074.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Generated code for function like this:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;/* Redirect standard code generation to ITCM */&lt;BR /&gt;&lt;/EM&gt;&lt;EM&gt;__attribute__((section(".itcm_text")))&lt;BR /&gt;&lt;/EM&gt;&lt;EM&gt;&amp;nbsp; static void Motor_Drive_Subsystem(void)&lt;BR /&gt;&lt;/EM&gt;&lt;EM&gt;&amp;nbsp; { .... }&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Conclusion:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;No itcm_text segment in .o file&lt;/LI&gt;&lt;LI&gt;Gcc optimizes the function away completely (seen by disassembling .o file)&lt;/LI&gt;&lt;LI&gt;If I remove the “static” declaration of the function in the generated .c and manually recompile it I will get the .itcm_text segment in the .o file.&lt;/LI&gt;&lt;LI&gt;It looks like the “static” declaration makes the gcc compiler ignore the attribute prefix.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I set the block to “Reusable function” in modelsim, hoping this would remove the static declaration:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RNJ_1-1786705067131.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/394642iBEC72EEAA612B878/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RNJ_1-1786705067131.png" alt="RNJ_1-1786705067131.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I get:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Still no .itcm_text segment in .o file&lt;/LI&gt;&lt;LI&gt;Function still declared as “static” in generated c code&lt;/LI&gt;&lt;LI&gt;Disassembly of .o file shows that gcc keeps the function in the assembly code but there is no sign of directing to .itcm_text segment&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So is the “static” declaration the problem (something with settings in Simulink or embedded coder) or is the problem with gcc prioritizing “static” over the “attribute” declaration?&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2026 11:07:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/Gcc-ignoring-pragma-statements-to-place-code-into-ITCM-memory/m-p/2405278#M10799</guid>
      <dc:creator>RNJ</dc:creator>
      <dc:date>2026-08-14T11:07:40Z</dc:date>
    </item>
  </channel>
</rss>

