<h3>Contribution description</h3>
<p>This pull request allows to flash the kinetis boards without relying on a local target specific toolchain. A native one is still required for objdump.</p>
<p>This allows only having the toolchain in docker.</p>
<h3>Testing procedure</h3>
<p>Flashing any <code>kinetis</code> board that uses <code>wdog-disable.bin</code> to test the whole pull request. Like <code>pba-d-01-kw2x</code> or <code>mulle</code> flashing a kinetis board using <code>USE_OLD_OPENOCD=1</code>.</p>
<p>With this pull request it can flash without any <code>arm</code> toolchain (only <code>objdump</code> necessary)</p>
<details><summary><code>PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" DOCKER="sudo docker" BUILD_IN_DOCKER=1 RIOT_CI_BUILD=1  BOARD=pba-d-01-kw2x make -C examples/default/ flash</code></summary><p>
</p><pre><code>PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" DOCKER="sudo docker" BUILD_IN_DOCKER=1 RIOT_CI_BUILD=1  BOARD=pba-d-01-kw2x make -C examples/default/ flash
make: Entering directory '/home/harter/work/git/worktree/riot_master/examples/default'
Launching build container using image "riot/riotbuild:latest".
sudo docker run --rm -t -u "$(id -u)" \
    -v '/usr/share/zoneinfo/Europe/Berlin:/etc/localtime:ro' -v '/home/harter/work/git/worktree/riot_master:/data/riotbuild/riotbase' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'RIOTPROJECT=/data/riotbuild/riotbase' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles'    -v /home/harter/work/git/RIOT/.git:/home/harter/work/git/RIOT/.git \
    -e 'BOARD=pba-d-01-kw2x' -e 'RIOT_CI_BUILD=1' \
    -w '/data/riotbuild/riotbase/examples/default/' \
    'riot/riotbuild:latest' make
Building application "default" for "pba-d-01-kw2x" with MCU "kinetis".

   text    data     bss     dec     hex filename
  64116     604    6960   71680   11800 /data/riotbuild/riotbase/examples/default/bin/pba-d-01-kw2x/default.elf
/home/harter/work/git/worktree/riot_master/dist/tools/openocd/openocd.sh flash /home/harter/work/git/worktree/riot_master/examples/default/bin/pba-d-01-kw2x/default.elf
### Flashing Target ###
/home/harter/work/git/worktree/riot_master/examples/default/bin/pba-d-01-kw2x/default.elf is fine.
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
Info : add flash_bank kinetis kx.flash
adapter speed: 1000 kHz
none separate
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 1.0
Info : SWCLK/TCK = 0 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x2ba01477
Info : kx.cpu: hardware has 6 breakpoints, 4 watchpoints
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0* kx.cpu             cortex_m   little kx.cpu             running
Info : MDM: Chip is unsecured. Continuing.
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00000774 msp: 0x1fffc200
auto erase enabled
Info : Probing flash info for bank 0
Warn : Flash Configuration Field written.
Warn : Reset or power off the device to make settings effective.
wrote 65536 bytes from file /home/harter/work/git/worktree/riot_master/examples/default/bin/pba-d-01-kw2x/default.elf in 3.691923s (17.335 KiB/s)
34 bytes written at address 0x20000000
downloaded 34 bytes in 0.004008s (8.284 KiB/s)
target halted due to breakpoint, current mode: Thread
xPSR: 0x01000000 pc: 0x20000020 msp: 0x1fffc200
verified 64720 bytes in 0.845870s (74.720 KiB/s)
Info : MDM: Chip is unsecured. Continuing.
shutdown command invoked
Done flashing
make: Leaving directory '/home/harter/work/git/worktree/riot_master/examples/default'
</code></pre>
<p></p></details>
<p>In master it fails already when compiling the watchdog.</p>
<details><summary><code>Makefile:5: recipe for target 'wdog-disable.o' failed</code></summary><p>
</p><pre><code>PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" DOCKER="sudo docker" BUILD_IN_DOCKER=1 RIOT_CI_BUILD=1  BOARD=pba-d-01-kw2x make -C examples/default/ flash
make: Entering directory '/home/harter/work/git/worktree/riot_master/examples/default'
Launching build container using image "riot/riotbuild:latest".
sudo docker run --rm -t -u "$(id -u)" \
    -v '/usr/share/zoneinfo/Europe/Berlin:/etc/localtime:ro' -v '/home/harter/work/git/worktree/riot_master:/data/riotbuild/riotbase' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'RIOTPROJECT=/data/riotbuild/riotbase' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles'    -v /home/harter/work/git/RIOT/.git:/home/harter/work/git/RIOT/.git \
    -e 'BOARD=pba-d-01-kw2x' -e 'RIOT_CI_BUILD=1' \
    -w '/data/riotbuild/riotbase/examples/default/' \
    'riot/riotbuild:latest' make
Building application "default" for "pba-d-01-kw2x" with MCU "kinetis".

   text    data     bss     dec     hex filename
  64116     604    6960   71680   11800 /data/riotbuild/riotbase/examples/default/bin/pba-d-01-kw2x/default.elf
arm-none-eabi-as -mthumb -o wdog-disable.o wdog-disable.s
make[1]: arm-none-eabi-as: Command not found
Makefile:5: recipe for target 'wdog-disable.o' failed
make[1]: *** [wdog-disable.o] Error 127
/home/harter/work/git/worktree/riot_master/cpu/kinetis/Makefile.include:52: recipe for target '/home/harter/work/git/worktree/riot_master/cpu/kinetis/dist/wdog-disable.bin' failed
make: *** [/home/harter/work/git/worktree/riot_master/cpu/kinetis/dist/wdog-disable.bin] Error 2
make: Leaving directory '/home/harter/work/git/worktree/riot_master/examples/default'
</code></pre>
<p></p></details>
<p>With the first commit only, it fails on <code>check-fcield</code>.</p>
<details><summary><code>cpu/kinetis/dist/check-fcfield-elf.sh: arm-none-eabi-objdump: not found<br>Abort flash procedure!<br>pre-flash checks failed, status=1</code></summary><p>
</p><pre><code>PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" DOCKER="sudo docker" BUILD_IN_DOCKER=1 RIOT_CI_BUILD=1  BOARD=pba-d-01-kw2x make -C examples/default/ flash                                                                                                       
make: Entering directory '/home/harter/work/git/worktree/riot_master/examples/default'                                                                                                                                                                                                    
Launching build container using image "riot/riotbuild:latest".                                                                                                                                                                                                                            
sudo docker run --rm -t -u "$(id -u)" \                                                                                                                                                                                                                                                   
    -v '/usr/share/zoneinfo/Europe/Berlin:/etc/localtime:ro' -v '/home/harter/work/git/worktree/riot_master:/data/riotbuild/riotbase' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'RIOTPROJECT=/d
ata/riotbuild/riotbase' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles'    -v /home/harter/work/git/RIOT/.git:/home/harter/work/git/RIOT/.git \                                                 
    -e 'BOARD=pba-d-01-kw2x' -e 'RIOT_CI_BUILD=1' \                                                                                                                                                                                                                                       
    -w '/data/riotbuild/riotbase/examples/default/' \                                                                                                                                                                                                                                     
    'riot/riotbuild:latest' make                                                                                                                                                                                                                                                          
[sudo] password for harter:                                                                                                                                                                                                                                                               
Building application "default" for "pba-d-01-kw2x" with MCU "kinetis".                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                                          
   text    data     bss     dec     hex filename                                                                                                                                                                                                                                          
  64116     604    6960   71680   11800 /data/riotbuild/riotbase/examples/default/bin/pba-d-01-kw2x/default.elf                                                                                                                                                                           
/home/harter/work/git/worktree/riot_master/dist/tools/openocd/openocd.sh flash /home/harter/work/git/worktree/riot_master/examples/default/bin/pba-d-01-kw2x/default.elf                                                                                                                  
### Flashing Target ###                                                                                                                                                                                                                                                                   
/home/harter/work/git/worktree/riot_master/cpu/kinetis/dist/check-fcfield-elf.sh: 12: /home/harter/work/git/worktree/riot_master/cpu/kinetis/dist/check-fcfield-elf.sh: arm-none-eabi-objdump: not found                                                                                  
Danger of bricking the device during flash!                                                                                                                                                                                                                                               
Flash configuration field of /home/harter/work/git/worktree/riot_master/examples/default/bin/pba-d-01-kw2x/default.elf:                                                                                                                                                                   
/home/harter/work/git/worktree/riot_master/cpu/kinetis/dist/check-fcfield-elf.sh: 19: /home/harter/work/git/worktree/riot_master/cpu/kinetis/dist/check-fcfield-elf.sh: arm-none-eabi-objdump: not found                                                                                  
Abort flash procedure!                                                                                                                                                                                                                                                                    
pre-flash checks failed, status=1                                                                                                                                                                                                                                                         
/home/harter/work/git/worktree/riot_master/examples/default/../../Makefile.include:538: recipe for target 'flash' failed                                                                                                                                                                  
make: *** [flash] Error 1                                                                                                                                                                                                                                                                 
make: Leaving directory '/home/harter/work/git/worktree/riot_master/examples/default'                                       
</code></pre>
<p></p>
<h3>Issues/PRs references</h3>
<p>This is part of compiling and flashing boards with only docker toolchain <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="403228350" data-permission-text="Issue title is private" data-url="https://github.com/RIOT-OS/RIOT/issues/10870" data-hovercard-type="pull_request" data-hovercard-url="/RIOT-OS/RIOT/pull/10870/hovercard" href="https://github.com/RIOT-OS/RIOT/pull/10870">#10870</a><br>
TODO Separate PR for <code>objdump</code></p></details>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/RIOT-OS/RIOT/pull/11545'>https://github.com/RIOT-OS/RIOT/pull/11545</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>cpu/kinetis/check-fcfield: use OBJDUMP</li>
  <li>makefiles/toolchain: fallback to 'objdump'</li>
  <li>kinetis: save 'wdog-disable.bin' binary in the repository</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/11545/files#diff-0">boards/common/frdm/Makefile.include</a>
    (3)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/11545/files#diff-1">boards/mulle/Makefile.include</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/11545/files#diff-2">boards/pba-d-01-kw2x/Makefile.include</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/11545/files#diff-3">cpu/kinetis/Makefile.include</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/11545/files#diff-4">cpu/kinetis/dist/README.md</a>
    (7)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/11545/files#diff-5">cpu/kinetis/dist/check-fcfield-elf.sh</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/11545/files#diff-6">cpu/kinetis/dist/check-fcfield-hex.sh</a>
    (4)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/11545/files#diff-7">cpu/kinetis/dist/wdog-disable.bin</a>
    (0)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/11545/files#diff-8">makefiles/toolchain/gnu.inc.mk</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/11545/files#diff-9">makefiles/toolchain/llvm.inc.mk</a>
    (2)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/11545.patch'>https://github.com/RIOT-OS/RIOT/pull/11545.patch</a></li>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/11545.diff'>https://github.com/RIOT-OS/RIOT/pull/11545.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/11545?email_source=notifications&email_token=ABE7WYAVUN7M4XCFYTP22H3PWJ7IFA5CNFSM4HOAYUYKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GUWGADQ">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYCTN2CJVDGKOMBD6LTPWJ7IFANCNFSM4HOAYUYA">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABE7WYDNY242IBGECVABGSTPWJ7IFA5CNFSM4HOAYUYKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GUWGADQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/11545?email_source=notifications\u0026email_token=ABE7WYAVUN7M4XCFYTP22H3PWJ7IFA5CNFSM4HOAYUYKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GUWGADQ",
"url": "https://github.com/RIOT-OS/RIOT/pull/11545?email_source=notifications\u0026email_token=ABE7WYAVUN7M4XCFYTP22H3PWJ7IFA5CNFSM4HOAYUYKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GUWGADQ",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>