<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en" style='--code-editor-font: var(--default-mono-font, "GitLab Mono"), JetBrains Mono, Menlo, DejaVu Sans Mono, Liberation Mono, Consolas, Ubuntu Mono, Courier New, andale mono, lucida console, monospace;'>
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>

<style data-premailer="ignore" type="text/css">
a { color: #1068bf; }
</style>

<style>img {
max-width: 100%; height: auto;
}
body {
font-size: .875rem;
}
body {
-webkit-text-shadow: rgba(255,255,255,.01) 0 0 1px;
}
body {
font-family: "GitLab Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; font-size: inherit;
}
</style>
</head>
<body style='font-size: inherit; -webkit-text-shadow: rgba(255,255,255,.01) 0 0 1px; font-family: "GitLab Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";'>
<div class="content">

<p class="details" style="font-style: italic; color: #737278;">
<a href="https://gitlab.rtems.org/ln">Luís Neto</a> created an issue: <a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5270">#5270</a>
</p>
<div class="md" style="position: relative; z-index: 1; color: #28272d; word-wrap: break-word;">
<h2 dir="auto" style="font-size: 1.5em; font-weight: 600; padding-bottom: .3em; border-bottom-width: 1px; border-bottom-color: #bfbfc3; border-bottom-style: solid; color: #28272d; margin: 0 0 16px;" align="initial">
<a href="#summary" aria-hidden="true" class="anchor" id="user-content-summary" style="margin-top: 0; float: left; margin-left: -20px; text-decoration: none; outline: none;"></a>Summary</h2>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial">A HardFault is consistently observed during application startup on the ATSAMV71 target when building and running the standard hello.exe sample from RTEMS 6.1. The fault occurs within the __libc_init_array function, indicating an issue with global static initialization.</p>
<h2 dir="auto" style="font-size: 1.5em; font-weight: 600; padding-bottom: .3em; border-bottom-width: 1px; border-bottom-color: #bfbfc3; border-bottom-style: solid; color: #28272d; margin: 24px 0 16px;" align="initial">
<a href="#target-hardware-details" aria-hidden="true" class="anchor" id="user-content-target-hardware-details" style="margin-top: 0; float: left; margin-left: -20px; text-decoration: none; outline: none;"></a>Target Hardware Details:</h2>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial"><strong style="font-weight: 600; margin-top: 0;">Processor Architecture:</strong> <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>ARM Cortex-M7</code>
<strong style="font-weight: 600;">Chip Family/Model:</strong> <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>ATSAMV711Q21</code>
<strong style="font-weight: 600;">Board Support Package (BSP):</strong> <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>atsamv</code> (specifically, <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>arm/atsamv</code> as used in the sb-set-builder configuration)</p>
<h2 dir="auto" style="font-size: 1.5em; font-weight: 600; padding-bottom: .3em; border-bottom-width: 1px; border-bottom-color: #bfbfc3; border-bottom-style: solid; color: #28272d; margin: 24px 0 16px;" align="initial">
<a href="#build-environment" aria-hidden="true" class="anchor" id="user-content-build-environment" style="margin-top: 0; float: left; margin-left: -20px; text-decoration: none; outline: none;"></a>Build Environment:</h2>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial"><strong style="font-weight: 600; margin-top: 0;">OS:</strong> Linux Ubuntu 22.04 LTS
<strong style="font-weight: 600;">RTEMS Source:</strong> Download from <a href="https://ftp.rtems.org/pub/rtems/releases/6/6.1/sources/rtems-6.1.tar.xz" rel="nofollow noreferrer noopener" target="_blank">https://ftp.rtems.org/pub/rtems/releases/6/6.1/sources/rtems-6.1.tar.xz</a>
<strong style="font-weight: 600;">RTEMS Source Builder:</strong> Download from <a href="https://ftp.rtems.org/pub/rtems/releases/6/6.1/sources/rtems-source-builder-6.1.tar.xz" rel="nofollow noreferrer noopener" target="_blank">https://ftp.rtems.org/pub/rtems/releases/6/6.1/sources/rtems-source-builder-6.1.tar.xz</a></p>
<h2 dir="auto" style="font-size: 1.5em; font-weight: 600; padding-bottom: .3em; border-bottom-width: 1px; border-bottom-color: #bfbfc3; border-bottom-style: solid; color: #28272d; margin: 24px 0 16px;" align="initial">
<a href="#steps-to-reproduce" aria-hidden="true" class="anchor" id="user-content-steps-to-reproduce" style="margin-top: 0; float: left; margin-left: -20px; text-decoration: none; outline: none;"></a>Steps to reproduce</h2>
<h3 dir="auto" style="font-size: 1.3em; margin: 24px 0 16px;" align="initial">
<a href="#1-build-the-rtems-toolchain-using-rsb" aria-hidden="true" class="anchor" id="user-content-1-build-the-rtems-toolchain-using-rsb" style="margin-top: 0; float: left; margin-left: -20px; text-decoration: none; outline: none;"></a>1. Build the RTEMS Toolchain using RSB:</h3>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre class="code highlight js-syntax-highlight language-plaintext" v-pre="true" style='display: block; font-size: 14px; color: #28272d; line-height: 1.6em; overflow-x: auto; border-radius: .25rem; position: relative; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; word-break: break-all; word-wrap: break-word; background-color: #fbfafd; margin: 0 0 16px; padding: 12px; border: 1px solid #dcdcde;'><code style='font-size: inherit; color: inherit; word-wrap: normal; word-break: keep-all; background-color: inherit; border-radius: .25rem; white-space: pre; margin-top: 0; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; overflow-wrap: normal; padding: unset;'><span id="LC1" class="line" lang="plaintext" style="margin-top: 0;">../source-builder/sb-set-builder --prefix=/home/ln/samv71/rtems/6.1 --target=rtems-arm --with-rtems-bsp=arm/atsam --with-rtems-tests=yes --with-rtems-bspopts="ATSAM_CHIP=samv71q21" 6/rtems-arm</span>
<span id="LC2" class="line" lang="plaintext">export PATH=/home/ln/samv71/rtems/6.1/bin:"$PATH"</span></code></pre>
<copy-code></copy-code><insert-code-snippet></insert-code-snippet>
</div>
<h3 dir="auto" style="font-size: 1.3em; margin: 24px 0 16px;" align="initial">
<a href="#2-build-the-rtems-helloexe-sample" aria-hidden="true" class="anchor" id="user-content-2-build-the-rtems-helloexe-sample" style="margin-top: 0; float: left; margin-left: -20px; text-decoration: none; outline: none;"></a>2. Build the RTEMS <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>hello.exe</code> Sample:</h3>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre class="code highlight js-syntax-highlight language-plaintext" v-pre="true" style='display: block; font-size: 14px; color: #28272d; line-height: 1.6em; overflow-x: auto; border-radius: .25rem; position: relative; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; word-break: break-all; word-wrap: break-word; background-color: #fbfafd; margin: 0 0 16px; padding: 12px; border: 1px solid #dcdcde;'><code style='font-size: inherit; color: inherit; word-wrap: normal; word-break: keep-all; background-color: inherit; border-radius: .25rem; white-space: pre; margin-top: 0; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; overflow-wrap: normal; padding: unset;'><span id="LC1" class="line" lang="plaintext" style="margin-top: 0;">1. ~/samv71/src/rtems-6.1$ ./waf bspdefaults --rtems-bsp=arm/atsamv > config.ini</span>
<span id="LC2" class="line" lang="plaintext">2. ~/samv71/src/rtems-6.1$ ./waf clean</span>
<span id="LC3" class="line" lang="plaintext">3. ~/samv71/src/rtems-6.1$ ./waf build</span>
<span id="LC4" class="line" lang="plaintext">4. ~/samv71/src/rtems-6.1$ ./waf install</span>
<span id="LC5" class="line" lang="plaintext">5. ~/samv71/src/rtems-6.1$ cp build/arm/atsamv/testsuites/samples/hello.exe build/arm/atsamv/testsuites/samples/hello.elf</span></code></pre>
<copy-code></copy-code><insert-code-snippet></insert-code-snippet>
</div>
<h3 dir="auto" style="font-size: 1.3em; margin: 24px 0 16px;" align="initial">
<a href="#3-run-the-helloexe-application" aria-hidden="true" class="anchor" id="user-content-3-run-the-helloexe-application" style="margin-top: 0; float: left; margin-left: -20px; text-decoration: none; outline: none;"></a>3. Run the <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>hello.exe</code> Application:</h3>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial">Flash the eval board using <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>MPLAB X IDE v6.25</code>.</p>
<h2 dir="auto" style="font-size: 1.5em; font-weight: 600; padding-bottom: .3em; border-bottom-width: 1px; border-bottom-color: #bfbfc3; border-bottom-style: solid; color: #28272d; margin: 24px 0 16px;" align="initial">
<a href="#expected-behavior" aria-hidden="true" class="anchor" id="user-content-expected-behavior" style="margin-top: 0; float: left; margin-left: -20px; text-decoration: none; outline: none;"></a>Expected Behavior:</h2>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial">The application should initialize successfully and print "Hello from RTEMS!" to the console.</p>
<h2 dir="auto" style="font-size: 1.5em; font-weight: 600; padding-bottom: .3em; border-bottom-width: 1px; border-bottom-color: #bfbfc3; border-bottom-style: solid; color: #28272d; margin: 24px 0 16px;" align="initial">
<a href="#actual-undesired-behavior" aria-hidden="true" class="anchor" id="user-content-actual-undesired-behavior" style="margin-top: 0; float: left; margin-left: -20px; text-decoration: none; outline: none;"></a>Actual Undesired Behavior:</h2>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial">The application crashes with a HardFault immediately during startup.</p>
<h2 dir="auto" style="font-size: 1.5em; font-weight: 600; padding-bottom: .3em; border-bottom-width: 1px; border-bottom-color: #bfbfc3; border-bottom-style: solid; color: #28272d; margin: 24px 0 16px;" align="initial">
<a href="#crash-analysis" aria-hidden="true" class="anchor" id="user-content-crash-analysis" style="margin-top: 0; float: left; margin-left: -20px; text-decoration: none; outline: none;"></a>Crash Analysis:</h2>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial">Upon inspecting the fault registers (captured from the HardFault handler), the following values were observed:</p>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial"><strong style="font-weight: 600; margin-top: 0;">PC:</strong> <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>0xFFFFFFFE</code>
<strong style="font-weight: 600;">LR:</strong> <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>0x0040a5db</code>
<strong style="font-weight: 600;">SP:</strong> <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>0x20404f28</code>
<strong style="font-weight: 600;">MMFSR:</strong> <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>0x00000001</code> (IACCVIOL bit is set)
<strong style="font-weight: 600;">MMFARVALID:</strong> 0</p>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial">The <strong style="font-weight: 600; margin-top: 0;">PC</strong> = <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>0xFFFFFFFE</code> combined with <strong style="font-weight: 600;">IACCVIOL</strong> = 1 indicates an Instruction Access Violation, meaning the processor attempted to fetch and execute an instruction from an invalid memory address.</p>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial">Disassembly of <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>hello.exe</code> around the LR address (<code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>0x0040a5db</code>) shows the context within <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>__libc_init_array</code>:</p>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre class="code highlight js-syntax-highlight language-plaintext" v-pre="true" style='display: block; font-size: 14px; color: #28272d; line-height: 1.6em; overflow-x: auto; border-radius: .25rem; position: relative; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; word-break: break-all; word-wrap: break-word; background-color: #fbfafd; margin: 0 0 16px; padding: 12px; border: 1px solid #dcdcde;'><code style='font-size: inherit; color: inherit; word-wrap: normal; word-break: keep-all; background-color: inherit; border-radius: .25rem; white-space: pre; margin-top: 0; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; overflow-wrap: normal; padding: unset;'><span id="LC1" class="line" lang="plaintext" style="margin-top: 0;">0040a5a0 <__libc_init_array>:</span>
<span id="LC2" class="line" lang="plaintext">  40a5a0: 4b0f      ldr r3, [pc, #60] @ (40a5e0 <__libc_init_array+0x40>)</span>
<span id="LC3" class="line" lang="plaintext">  40a5a2: b570      push {r4, r5, r6, lr}</span>
<span id="LC4" class="line" lang="plaintext">  40a5a4: 4d0f      ldr r5, [pc, #60] @ (40a5e4 <__libc_init_array+0x44>)</span>
<span id="LC5" class="line" lang="plaintext">  40a5a6: 42ab      cmp r3, r5</span>
<span id="LC6" class="line" lang="plaintext">  40a5a8: eba3 0605 sub.w r6, r3, r5</span>
<span id="LC7" class="line" lang="plaintext">  40a5ac: d007      beq.n 40a5be <__libc_init_array+0x1e></span>
<span id="LC8" class="line" lang="plaintext">  40a5ae: 10b6      asrs r6, r6, #2</span>
<span id="LC9" class="line" lang="plaintext">  40a5b0: 2400      movs r4, #0</span>
<span id="LC10" class="line" lang="plaintext">  40a5b2: 3401      adds r4, #1</span>
<span id="LC11" class="line" lang="plaintext">  40a5b4: f855 3b04 ldr.w r3, [r5], #4</span>
<span id="LC12" class="line" lang="plaintext">  40a5b8: 4798      blx r3</span>
<span id="LC13" class="line" lang="plaintext">  40a5ba: 42a6      cmp r6, r4</span>
<span id="LC14" class="line" lang="plaintext">  40a5bc: d8f9      bhi.n 40a5b2 <__libc_init_array+0x12></span>
<span id="LC15" class="line" lang="plaintext">  40a5be: 4d0a      ldr r5, [pc, #40] @ (40a5e8 <__libc_init_array+0x48>)</span>
<span id="LC16" class="line" lang="plaintext">  40a5c0: f002 fa66 bl 40ca90 <_init></span>
<span id="LC17" class="line" lang="plaintext">  40a5c4: 4b09      ldr r3, [pc, #36] @ (40a5ec <__libc_init_array+0x4c>)</span>
<span id="LC18" class="line" lang="plaintext">  40a5c6: 1b5e      subs r6, r3, r5</span>
<span id="LC19" class="line" lang="plaintext">  40a5c8: 42ab      cmp r3, r5</span>
<span id="LC20" class="line" lang="plaintext">  40a5ca: ea4f 06a6 mov.w r6, r6, asr #2</span>
<span id="LC21" class="line" lang="plaintext">  40a5ce: d006      beq.n 40a5de <__libc_init_array+0x3e></span>
<span id="LC22" class="line" lang="plaintext">  40a5d0: 2400      movs r4, #0</span>
<span id="LC23" class="line" lang="plaintext">  40a5d2: 3401      adds r4, #1</span>
<span id="LC24" class="line" lang="plaintext">  40a5d4: f855 3b04 ldr.w r3, [r5], #4</span>
<span id="LC25" class="line" lang="plaintext">  40a5d8: 4798      blx r3</span>
<span id="LC26" class="line" lang="plaintext">  40a5da: 42a6      cmp r6, r4</span>
<span id="LC27" class="line" lang="plaintext">  40a5dc: d8f9      bhi.n 40a5d2 <__libc_init_array+0x32></span>
<span id="LC28" class="line" lang="plaintext">  40a5de: bd70      pop {r4, r5, r6, pc}</span>
<span id="LC29" class="line" lang="plaintext">  40a5e0: 0040ea2c .word 0x0040ea2c</span>
<span id="LC30" class="line" lang="plaintext">  40a5e4: 0040ea2c .word 0x0040ea2c</span>
<span id="LC31" class="line" lang="plaintext">  40a5e8: 0040ea2c .word 0x0040ea2c</span>
<span id="LC32" class="line" lang="plaintext">  40a5ec: 0040ea30 .word 0x0040ea30</span></code></pre>
<copy-code></copy-code><insert-code-snippet></insert-code-snippet>
</div>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial">At the point of crash:</p>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial">The <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>ldr.w r3, [r5], #4</code> instruction at <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>0x40a5d4</code> loads a value into <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>r3</code>.
The <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>r5</code> value at crash (<code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>0x0040ea30</code>) indicates that the load happened from <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>0x0040ea2c</code> (since <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>r5</code> is incremented by 4 after the load).
The <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>objdump -s -j .init_array hello.exe</code> confirms the content at <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>0x40ea2c</code>:</p>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre class="code highlight js-syntax-highlight language-plaintext" v-pre="true" style='display: block; font-size: 14px; color: #28272d; line-height: 1.6em; overflow-x: auto; border-radius: .25rem; position: relative; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; word-break: break-all; word-wrap: break-word; background-color: #fbfafd; margin: 0 0 16px; padding: 12px; border: 1px solid #dcdcde;'><code style='font-size: inherit; color: inherit; word-wrap: normal; word-break: keep-all; background-color: inherit; border-radius: .25rem; white-space: pre; margin-top: 0; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; overflow-wrap: normal; padding: unset;'><span id="LC1" class="line" lang="plaintext" style="margin-top: 0;">Contents of section .init_array:</span>
<span id="LC2" class="line" lang="plaintext"> 40ea2c ad044000</span>
<span id="LC3" class="line" lang="plaintext">(Which, in little-endian, means 0x004004ad).</span></code></pre>
<copy-code></copy-code><insert-code-snippet></insert-code-snippet>
</div>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial">Therefore, the <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>blx r3</code> instruction at <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>0x40a5d8</code> attempts to jump to <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>0x004004ad</code>.</p>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial">Further <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>addr2line</code> reveals:</p>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial"><code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>addr2line -e hello.exe 0x004004ad output: crtstuff.c:?</code></p>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial">However, this entry contains the address <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>0x004004ad</code>, which is not a valid executable function pointer. Instead, it points to data or misaligned, non-executable bytes within the <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>frame_dummy</code> function (part of <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>crtstuff.c</code> and <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>libgcc</code>). Executing this address triggers the Instruction Access Violation.</p>
<p dir="auto" style="color: #28272d; margin: 0;" align="initial">This indicates that a corrupted or incorrect address has been placed as the initial constructor entry in the <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>.init_array</code> section during the compilation and linking of the <code style='font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; font-family: "GitLab Mono","JetBrains Mono","Menlo","DejaVu Sans Mono","Liberation Mono","Consolas","Ubuntu Mono","Courier New","andale mono","lucida console",monospace; vertical-align: bottom; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 2px 4px;'>hello.exe</code> sample. This suggests a potential issue within the RTEMS 6.1 toolchain components (specifically libgcc/Newlib's) for this target.</p>
</div>

</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #737278;">

<br>
<a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5270">View it on GitLab</a>.
<br>
You're receiving this email because of your account on <a target="_blank" rel="noopener noreferrer" href="https://gitlab.rtems.org">gitlab.rtems.org</a>. <a href="https://gitlab.rtems.org/-/sent_notifications/0473b67f92bf7f84f36fe4b60e1abf55/unsubscribe" target="_blank" rel="noopener noreferrer">Unsubscribe</a> from this thread · <a href="https://gitlab.rtems.org/-/profile/notifications" target="_blank" rel="noopener noreferrer" class="mng-notif-link">Manage all notifications</a> · <a href="https://gitlab.rtems.org/help" target="_blank" rel="noopener noreferrer" class="help-link">Help</a>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5270"}}</script>


</p>
</div>
</body>
</html>