Skip to content

Commit

Permalink
Create eep file if using VSCode instead of Eclipse
Browse files Browse the repository at this point in the history
Building the EEPROM image file was missing when using VSCode as IDE or platformio CLI
  • Loading branch information
tsandmann committed Jun 1, 2022
1 parent 88e096b commit 60a1242
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 1 deletion.
23 changes: 23 additions & 0 deletions mcu_post_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# c't-Bot
#
# This program is free software; you can redistribute it
# and/or modify it under the terms of the GNU General
# Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your
# option) any later version.
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.


Import("env")

env.AddPostAction("$BUILD_DIR/${PROGNAME}.elf", env.VerboseAction(" ".join(["$OBJCOPY", "-j", ".eeprom --set-section-flags=.eeprom='alloc,load'",
"--change-section-lma", ".eeprom=0", "-O", "ihex", '"$BUILD_DIR/${PROGNAME}.elf"', '"$BUILD_DIR/${PROGNAME}.eep"']), "Building $BUILD_DIR/${PROGNAME}.eep")
)
21 changes: 21 additions & 0 deletions mcu_pre_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# c't-Bot
#
# This program is free software; you can redistribute it
# and/or modify it under the terms of the GNU General
# Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your
# option) any later version.
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.


Import("env")

env.Replace(PROGNAME="ct-Bot")
2 changes: 2 additions & 0 deletions native_linkflags.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

Import("env")

env.Replace(PROGNAME="ct-Bot")

if "windows" in get_systype():
env.Append(
LIBS=[
Expand Down
7 changes: 6 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ board_build.f_cpu = 16000000UL
;board_build.f_cpu = 20000000UL
build_unflags = -std=gnu++11 -fno-fat-lto-objects -flto -fuse-linker-plugin
build_flags = -std=gnu++17 -Wextra -Wmissing-declarations -Wshadow -Wformat=2 -Wconversion -DMCU -Iinclude -Iinclude/bot-logic -Imcu/SdFat
extra_scripts =
pre:mcu_pre_build.py
post:mcu_post_build.py

upload_protocol = avr109
upload_flags = -u
Expand All @@ -30,6 +33,7 @@ platform = ${mcu.platform}
board_build.f_cpu = ${mcu.board_build.f_cpu}
build_unflags = ${mcu.build_unflags}
build_flags = ${mcu.build_flags} -Wl,--section-start=.bootloader=0x1F800
extra_scripts = ${mcu.extra_scripts}

upload_protocol = ${mcu.upload_protocol}
upload_flags = ${mcu.upload_flags}
Expand All @@ -41,6 +45,7 @@ platform = ${mcu.platform}
board_build.f_cpu = ${mcu.board_build.f_cpu}
build_unflags = ${mcu.build_unflags}
build_flags = ${mcu.build_flags} -Wl,--section-start=.bootloader=0x1F800
extra_scripts = ${mcu.extra_scripts}

upload_protocol = ${mcu.upload_protocol}
upload_flags = ${mcu.upload_flags}
Expand All @@ -49,7 +54,7 @@ upload_port = ${mcu.upload_port}
[native]
platform = native
build_flags = -std=gnu++17 -Wextra -Wmissing-declarations -Wshadow -Wformat=2 -g -O2 -DPC -Iinclude -Iinclude/bot-logic -lpthread
extra_scripts = native_linkflags.py
extra_scripts = pre:native_linkflags.py

[env:native]
platform = ${native.platform}
Expand Down

0 comments on commit 60a1242

Please sign in to comment.