Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions firmware/config/boards/common_make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ fi

if uname | grep "NT"; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can tap/factor the platform detection logic in firmware/use_arm_gcc.mk, in the future.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean that you'd like to make the detection just there and pass it along the build process? I did take inspiration from the logic there, but I didn't find a simple way to pass it along to the common_make script

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I wanted to create awareness about it; glad you'd seen it.
  2. We'd have to factor something to make them common, but I'm not sure along which lines makes sense (entirely w/in Make, via vars? or via callable .sh script? or ??)
  3. I don't expect it to be part of this changeset; unnecessary unless there's an obvious solution.

HEX2DFU=../misc/encedo_hex2dfu/hex2dfu.exe
elif uname | grep "Darwin"; then
HEX2DFU=../misc/encedo_hex2dfu/hex2dfu_darwin.bin
TOOLCHAIN=ext/build-tools/arm-gnu-toolchain-11.3.rel1-darwin-x86_64-arm-none-eabi/bin/arm-none-eabi-
else
HEX2DFU=../misc/encedo_hex2dfu/hex2dfu.bin
TOOLCHAIN=ext/build-tools/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-
fi
chmod u+x $HEX2DFU

Expand All @@ -47,7 +51,7 @@ rm -f deliver/*
rm build/fome.bin build/fome.srec

# Extract the firmware's base address from the elf - it may be different depending on exact CPU
firmwareBaseAddress="$(objdump -h -j .vectors build/fome.elf | awk '/.vectors/ {print $5 }')"
firmwareBaseAddress="$($TOOLCHAIN"objdump" -h -j .vectors build/fome.elf | awk '/.vectors/ {print $5 }')"
checksumAddress="$(printf "%X\n" $((0x$firmwareBaseAddress+0x1c)))"

echo "Base address is 0x$firmwareBaseAddress"
Expand All @@ -57,8 +61,8 @@ echo "$SCRIPT_NAME: invoking hex2dfu to place image checksum"
$HEX2DFU -i build/fome.hex -c $checksumAddress -b build/fome.bin
rm build/fome.hex
# re-make hex, srec with the checksum in place
objcopy -I binary -O ihex --change-addresses=0x$firmwareBaseAddress build/fome.bin build/fome.hex
objcopy -I binary -O srec --change-addresses=0x$firmwareBaseAddress build/fome.bin build/fome.srec
$TOOLCHAIN"objcopy" -I binary -O ihex --change-addresses=0x$firmwareBaseAddress build/fome.bin build/fome.hex
$TOOLCHAIN"objcopy" -I binary -O srec --change-addresses=0x$firmwareBaseAddress build/fome.bin build/fome.srec

if [ "$USE_OPENBLT" = "yes" ]; then
# this image is suitable for update through bootloader only
Expand Down
Binary file added misc/encedo_hex2dfu/hex2dfu_darwin.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion misc/hex2dfu
Submodule hex2dfu updated 1 files
+58 −9 hex2dfu.c
Loading