<?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>S32KのトピックRe: Flashing executable that has cross-compiled in ubuntu</title>
    <link>https://community.nxp.com/t5/S32K/Flashing-executable-that-has-cross-compiled-in-ubuntu/m-p/1771588#M29463</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;before you can execute main() function - you need to perform some startup for target device - like init memory and so on. Also linker file script is required to place code into proper memory space.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To get better overview you can create new empty project in S32DS for your target and check what is required for minimal hello world project.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Dec 2023 15:03:22 GMT</pubDate>
    <dc:creator>jiri_kral</dc:creator>
    <dc:date>2023-12-08T15:03:22Z</dc:date>
    <item>
      <title>Flashing executable that has cross-compiled in ubuntu</title>
      <link>https://community.nxp.com/t5/S32K/Flashing-executable-that-has-cross-compiled-in-ubuntu/m-p/1771027#M29426</link>
      <description>&lt;P&gt;Hello. I cross-compiled a .cpp file for my &lt;STRONG&gt;S32K148EVB-Q176&lt;/STRONG&gt; in my ubuntu x86_64 VM with the following command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -o deneme-arm deneme.cpp -lstdc++ -lc&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I am getting these errors:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(lib_a-abort.o): in function `abort':
/build/newlib-pB30de/newlib-3.3.0/build/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/stdlib/../../../../../../../../newlib/libc/stdlib/abort.c:59: undefined reference to `_exit'
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(lib_a-exit.o): in function `exit':
/build/newlib-pB30de/newlib-3.3.0/build/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/stdlib/../../../../../../../../newlib/libc/stdlib/exit.c:64: undefined reference to `_exit'
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(lib_a-fstatr.o): in function `_fstat_r':
/build/newlib-pB30de/newlib-3.3.0/build/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/reent/../../../../../../../../newlib/libc/reent/fstatr.c:55: undefined reference to `_fstat'
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(lib_a-openr.o): in function `_open_r':
/build/newlib-pB30de/newlib-3.3.0/build/arm-none-eabi/thumb/v7e-m+fp/hard/newlib/libc/reent/../../../../../../../../newlib/libc/reent/openr.c:50: undefined reference to `_open'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My main goal is to build this program (which is a basic .cpp hello_world kind of file) in my linux machine for arm-32 architecture and then flash it to the board by itself using S32 Design Studio.&lt;/P&gt;&lt;P&gt;Beforehand I tried to compile a .c file with this command:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;arm-linux-gnueabi-gcc hello.c -o hello-arm&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It successfully generates an ELF arm-32 executable file. But when I try to flash it wiht &lt;STRONG&gt;S32DS&amp;nbsp;&lt;/STRONG&gt;to the board. I get below errors:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;-Bus fault.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;-Hard fault.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;----------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;-So my first question is this,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1) How can I cross-compile a .cpp code in my Linux terminal with using commands for&amp;nbsp;&lt;STRONG&gt;S32K148EVB&lt;/STRONG&gt; board.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Second question is,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;2a) If I successfully compile, how can I flash the generated executable by itself using S32 Design Studio.&lt;/P&gt;&lt;P&gt;2b) Or suppose if I compiled an executable for the desired architecture like I showed with the second command. How can I successfully embed this executable to correct memory address in the board?&lt;/P&gt;&lt;P&gt;An explanation for this process would be really helpful. Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 19:08:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Flashing-executable-that-has-cross-compiled-in-ubuntu/m-p/1771027#M29426</guid>
      <dc:creator>CanCan</dc:creator>
      <dc:date>2023-12-07T19:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Flashing executable that has cross-compiled in ubuntu</title>
      <link>https://community.nxp.com/t5/S32K/Flashing-executable-that-has-cross-compiled-in-ubuntu/m-p/1771588#M29463</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;before you can execute main() function - you need to perform some startup for target device - like init memory and so on. Also linker file script is required to place code into proper memory space.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To get better overview you can create new empty project in S32DS for your target and check what is required for minimal hello world project.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 15:03:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Flashing-executable-that-has-cross-compiled-in-ubuntu/m-p/1771588#M29463</guid>
      <dc:creator>jiri_kral</dc:creator>
      <dc:date>2023-12-08T15:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Flashing executable that has cross-compiled in ubuntu</title>
      <link>https://community.nxp.com/t5/S32K/Flashing-executable-that-has-cross-compiled-in-ubuntu/m-p/1771841#M29476</link>
      <description>&lt;P&gt;My proposal is this following,&lt;/P&gt;&lt;P&gt;I take the startup and necessary libraries for the board to my linux environment and wrote a main.cpp as following:&lt;/P&gt;&lt;P&gt;#include &amp;lt;iostream&amp;gt;&lt;/P&gt;&lt;P&gt;#include "S32K148.h"&lt;/P&gt;&lt;P&gt;//rest is my simple hello_world code&lt;/P&gt;&lt;P&gt;Can I cross-compile above code as a project in my linux terminal and generate a single ELF 32 executable using certain commands? If so, what are those commands?&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2023 19:36:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Flashing-executable-that-has-cross-compiled-in-ubuntu/m-p/1771841#M29476</guid>
      <dc:creator>CanCan</dc:creator>
      <dc:date>2023-12-10T19:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: Flashing executable that has cross-compiled in ubuntu</title>
      <link>https://community.nxp.com/t5/S32K/Flashing-executable-that-has-cross-compiled-in-ubuntu/m-p/1772835#M29535</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;yes, it is possible. Best way is examine existing project from S32DS. This is build command from S32DS:&lt;BR /&gt;&lt;BR /&gt;arm-none-eabi-gcc -DCPU_S32K148 -I"C:\Users\nxf24838\workspaceS32DS.3.5.6\s32k148_empty/include" -O0 -g3 -Wall -c -fmessage-length=0 -ffunction-sections -fdata-sections -mcpu=cortex-m4 -specs=nosys.specs&lt;/P&gt;
&lt;P&gt;For linker:&lt;/P&gt;
&lt;P&gt;arm-none-eabi-gcc -T"C:\Users\nxf24838\workspaceS32DS.3.5.6\s32k148_empty/Project_Settings/Linker_Files/S32K148_256_flash.ld" -Wl,-Map,"s32k148_empty.map" -Xlinker --gc-sections -n -mcpu=cortex-m4 -specs=nosys.specs&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are experimenting with your own settings - make sure that on address 0x400 is correct flash config value. With random data on this address there is high chance that you turn your MCU into brick&amp;nbsp; (mass erase disabled and chip secured).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 06:51:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Flashing-executable-that-has-cross-compiled-in-ubuntu/m-p/1772835#M29535</guid>
      <dc:creator>jiri_kral</dc:creator>
      <dc:date>2023-12-12T06:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Flashing executable that has cross-compiled in ubuntu</title>
      <link>https://community.nxp.com/t5/S32K/Flashing-executable-that-has-cross-compiled-in-ubuntu/m-p/1774623#M29616</link>
      <description>&lt;P&gt;Thank you for the solution advise. I will get back to you with the result when I try this approach.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 08:52:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Flashing-executable-that-has-cross-compiled-in-ubuntu/m-p/1774623#M29616</guid>
      <dc:creator>CanCan</dc:creator>
      <dc:date>2023-12-14T08:52:52Z</dc:date>
    </item>
  </channel>
</rss>

