Skip to content

Commit

Permalink
Build system fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
eerimoq committed Oct 22, 2016
1 parent e28e952 commit 5d724e3
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 100 deletions.
4 changes: 0 additions & 4 deletions bin/dbgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ def main():
ldflags = get_make_variable(board, "LDFLAGS").split()
database["boards"][board]["ldflags"] = ldflags

# Get LDFLAGS_AFTER.
ldflags_after = get_make_variable(board, "LDFLAGS_AFTER").split()
database["boards"][board]["ldflags_after"] = ldflags_after

# Get LIB.
lib = get_make_variable(board, "LIB").split()
database["boards"][board]["lib"] = lib
Expand Down
3 changes: 2 additions & 1 deletion bin/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def test():
("avr", "pro-micro"),
("sam", "arduino_due_x_dbg"),
("esp", "esp01"),
("esp", "esp12e")]:
("esp", "esp12e"),
("esp32", "nano32")]:
command = [
"make",
"all",
Expand Down
2 changes: 2 additions & 0 deletions doc/developer-guide/releasing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ Follow these steps to create a new release:
scp simba-arduino/simba-arduino-avr-*.zip <user>@frs.sourceforge.net:/home/frs/project/simba-arduino/avr
scp simba-arduino/simba-arduino-sam-*.zip <user>@frs.sourceforge.net:/home/frs/project/simba-arduino/sam
scp simba-arduino/simba-arduino-esp-*.zip <user>@frs.sourceforge.net:/home/frs/project/simba-arduino/esp
scp simba-arduino/simba-arduino-esp32-*.zip <user>@frs.sourceforge.net:/home/frs/project/simba-arduino/esp32
scp make/arduino/avr/package_simba_avr_index.json <user>@frs.sourceforge.net:/home/frs/project/simba-arduino/avr
scp make/arduino/sam/package_simba_sam_index.json <user>@frs.sourceforge.net:/home/frs/project/simba-arduino/sam
scp make/arduino/esp/package_simba_esp_index.json <user>@frs.sourceforge.net:/home/frs/project/simba-arduino/esp
scp make/arduino/esp32/package_simba_esp32_index.json <user>@frs.sourceforge.net:/home/frs/project/simba-arduino/esp32
10. Download the release zip-file from Github and calculate its SHA1
checksum. Upload the zip-file to sourceforge and add the new
Expand Down
5 changes: 3 additions & 2 deletions make/app.mk
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ release:

$(EXE): $(OBJ) $(GENOBJ)
@echo "LD $@"
$(CXX) -o $@ $(LIBPATH:%=-L%) $(LDFLAGS) $^ $(LDFLAGS_AFTER)
$(CXX) $(LIBPATH:%=-L%) $(LDFLAGS) -Wl,--start-group $(LIB:%=-l%) $^ -Wl,--end-group -o $@

settings-generate: $(SETTINGS_INI)
@echo "Generating settings from $<"
Expand Down Expand Up @@ -251,7 +251,8 @@ RSFLAGS = \
$(RSFLAGS_EXTRA)

ifeq ($(RUST), yes)
LDFLAGS_AFTER += -lsimba $(RUST_LIBRARIES:%=-l%) -L $(RUSTLIB)
LIB += simba $(RUST_LIBRARIES)
LDFLAGS += -L $(RUSTLIB)

generate: $(RUST_LIBRARIES:%=$(RUSTLIB)/lib%.a) $(RUSTLIB)/$(RUST_LIBSIMBA)
endif
Expand Down
17 changes: 7 additions & 10 deletions make/arduino/arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ def generate_cores(family, database):

if database["mcus"][mcu]["family"] != family:
continue

# For ESP...
board["src"] = list(set(board["src"]) - set(["3pp/libc/string0.c"]))

if cores_srcs is None:
cores_srcs = set(board["src"])
Expand Down Expand Up @@ -269,14 +266,14 @@ def get_c_elf_extra_flags(board, database):
for libpath in libpaths])


def get_c_elf_extra_flags_after(board, database):
"""Get library path, defines and flags to the linker.
def get_c_elf_libs(board, database):
"""Get libraries.
"""

ldflags_after = database["boards"][board]["ldflags_after"]
libs = database["boards"][board]["lib"]

return " ".join(ldflags_after)
return " ".join(["-l" + lib for lib in libs])


def generate_boards_txt_avr(database, boards_txt_fmt):
Expand Down Expand Up @@ -340,11 +337,11 @@ def generate_boards_txt_esp(database, boards_txt_fmt):
esp01_compiler_c_extra_flags=get_c_extra_flags("esp01", database),
esp01_compiler_cxx_extra_flags=get_cxx_extra_flags("esp01", database),
esp01_compiler_c_elf_extra_flags=esp01_compiler_c_elf_extra_flags,
esp01_compiler_c_elf_extra_flags_after=get_c_elf_extra_flags_after("esp01", database),
esp01_compiler_c_elf_libs=get_c_elf_libs("esp01", database),
esp12e_compiler_c_extra_flags=get_c_extra_flags("esp12e", database),
esp12e_compiler_cxx_extra_flags=get_cxx_extra_flags("esp12e", database),
esp12e_compiler_c_elf_extra_flags=esp12e_compiler_c_elf_extra_flags,
esp12e_compiler_c_elf_extra_flags_after=get_c_elf_extra_flags_after("esp12e", database))
esp12e_compiler_c_elf_libs=get_c_elf_libs("esp12e", database))

def generate_boards_txt_esp32(database, boards_txt_fmt):
"""Generate boards.txt for ESP32.
Expand All @@ -362,7 +359,7 @@ def generate_boards_txt_esp32(database, boards_txt_fmt):
nano32_compiler_c_extra_flags=get_c_extra_flags("nano32", database),
nano32_compiler_cxx_extra_flags=get_cxx_extra_flags("nano32", database),
nano32_compiler_c_elf_extra_flags=nano32_compiler_c_elf_extra_flags,
nano32_compiler_c_elf_extra_flags_after=get_c_elf_extra_flags_after("nano32", database))
nano32_compiler_c_elf_libs=get_c_elf_libs("nano32", database))


def generate_configuration_files(family, database):
Expand Down
4 changes: 2 additions & 2 deletions make/arduino/esp/boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ esp01.build.flash_freq=40
esp01.compiler.c.extra_flags={esp01_compiler_c_extra_flags}
esp01.compiler.cpp.extra_flags={esp01_compiler_cxx_extra_flags}
esp01.compiler.c.elf.extra_flags={esp01_compiler_c_elf_extra_flags}
esp01.compiler.c.elf.extra_flags_after={esp01_compiler_c_elf_extra_flags_after}
esp01.compiler.c.elf.libs={esp01_compiler_c_elf_libs}

##################################################################

Expand All @@ -68,6 +68,6 @@ esp12e.build.flash_freq=40
esp12e.compiler.c.extra_flags={esp12e_compiler_c_extra_flags}
esp12e.compiler.cpp.extra_flags={esp12e_compiler_cxx_extra_flags}
esp12e.compiler.c.elf.extra_flags={esp12e_compiler_c_elf_extra_flags}
esp12e.compiler.c.elf.extra_flags_after={esp12e_compiler_c_elf_extra_flags_after}
esp12e.compiler.c.elf.libs={esp12e_compiler_c_elf_libs}

##################################################################
3 changes: 1 addition & 2 deletions make/arduino/esp/platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ build.extra_flags=
# These can be overridden in platform.local.txt
compiler.c.extra_flags=
compiler.c.elf.extra_flags=
compiler.c.elf.extra_flags_after=
compiler.S.extra_flags=
compiler.ar.extra_flags=
compiler.elf2hex.extra_flags=
Expand All @@ -89,7 +88,7 @@ archive_file_path={build.path}/{archive_file}
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"

## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.combine.flags} {object_files} "{build.path}/{archive_file}" {compiler.c.elf.extra_flags_after}
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.combine.flags} -Wl,--start-group {object_files} "{build.path}/{archive_file}" {compiler.c.elf.libs} -Wl,--end-group

## Create output (.bin file)
recipe.objcopy.hex.pattern="{runtime.tools.esptool.path}/{compiler.esptool.cmd}" -eo "{runtime.platform.path}/bootloaders/eboot/eboot.elf" -bo "{build.path}/{build.project_name}.bin" -bm {build.flash_mode} -bf {build.flash_freq} -bz {build.flash_size} -bs .text -bp 4096 -ec -eo "{build.path}/{build.project_name}.elf" -bs .irom0.text -bs .text -bs .data -bs .rodata -bc -ec
Expand Down
6 changes: 3 additions & 3 deletions make/arduino/esp32/boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ nano32.build.f_cpu=80000000L
nano32.build.board=NANO32
nano32.build.variant=nano32
nano32.build.core=Simba:simba
nano32.build.ldscript=simba.flash.1m.ld
nano32.build.flash_size=512K
nano32.build.ldscript=simba.flash.ld
nano32.build.flash_size=4M
nano32.build.flash_mode=dio
nano32.build.flash_freq=40

nano32.compiler.c.extra_flags={nano32_compiler_c_extra_flags}
nano32.compiler.cpp.extra_flags={nano32_compiler_cxx_extra_flags}
nano32.compiler.c.elf.extra_flags={nano32_compiler_c_elf_extra_flags}
nano32.compiler.c.elf.extra_flags_after={nano32_compiler_c_elf_extra_flags_after}
nano32.compiler.c.elf.libs={nano32_compiler_c_elf_libs}

##################################################################
2 changes: 1 addition & 1 deletion make/arduino/esp32/package_simba_esp32_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"url": "https://sourceforge.net/projects/simba-arduino/files/esp32/simba-arduino-esp32-esp32.zip",
"archiveFileName": "simba-arduino-esp32-esp32.zip",
"checksum": "SHA-256:60c45b7feb37dc19cf5a922215aa5a018aa1e0737e8bfe339c005d0b8527f0cf",
"checksum": "SHA-256:fe28fd07d5a877e55d495fc8b076c07aaa4ae439408ec7401d6a8757d71b1862",
"size": "17456828",
"boards": [
{"name" : "NANO32"}
Expand Down
3 changes: 1 addition & 2 deletions make/arduino/esp32/platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ build.extra_flags=
# These can be overridden in platform.local.txt
compiler.c.extra_flags=
compiler.c.elf.extra_flags=
compiler.c.elf.extra_flags_after=
compiler.S.extra_flags=
compiler.ar.extra_flags=
compiler.elf2hex.extra_flags=
Expand All @@ -90,7 +89,7 @@ archive_file_path={build.path}/{archive_file}
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"

## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.combine.flags} {object_files} "{build.path}/{archive_file}" {compiler.c.elf.extra_flags_after}
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.combine.flags} -Wl,--start-group {object_files} "{build.path}/{archive_file}" {compiler.c.elf.libs} -Wl,--end-group

## Create output (.bin file)
recipe.objcopy.hex.pattern="{compiler.python.cmd}" "{runtime.platform.path}/tools/esptool.py" --chip esp32 elf2image --flash_mode dio --flash_freq 40m -o "{build.path}/{build.project_name}.bin" "{build.path}/{build.project_name}.elf"
Expand Down
8 changes: 6 additions & 2 deletions make/gnu/linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@
CROSS_COMPILE =
CFLAGS += -Werror -Wno-error=unused-variable -DCONFIG_PROFILE_STACK=0
CXXFLAGS += -Werror -Wno-error=unused-variable -DCONFIG_PROFILE_STACK=0
LDFLAGS_AFTER += -lpthread -lrt

CFLAGS += -pg -fprofile-arcs -ftest-coverage
CXXFLAGS += -pg -fprofile-arcs -ftest-coverage
LDFLAGS += -pg -fprofile-arcs -ftest-coverage -lgcov
LDFLAGS += -pg -fprofile-arcs -ftest-coverage

CFLAGS += -g
CXXFLAGS += -g
LDFLAGS += -g

LIB += \
gcov \
pthread \
rt

include $(SIMBA_ROOT)/make/gnu.mk
25 changes: 1 addition & 24 deletions make/platformio.sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,6 @@ BOARDS = {
"-pg",
"-fprofile-arcs",
"-ftest-coverage",
"-lgcov",
"-g",
"-Wl,-Map=build/cygwin/default_configuration.map",
"-Wl,--gc-sections"
Expand Down Expand Up @@ -1006,17 +1005,6 @@ BOARDS = {
"src/mcus/esp8266"
],
"ldflags": [
"-Wl,--start-group",
"-lhal",
"-lphy",
"-lpp",
"-lnet80211",
"-lwpa",
"-lcrypto",
"-lmain",
"-lfreertos",
"-llwip",
"-Wl,--end-group",
"-Wl,-Tsimba.flash.512k.ld",
"-u",
"call_user_start",
Expand Down Expand Up @@ -1160,17 +1148,6 @@ BOARDS = {
"src/mcus/esp8266"
],
"ldflags": [
"-Wl,--start-group",
"-lhal",
"-lphy",
"-lpp",
"-lnet80211",
"-lwpa",
"-lcrypto",
"-lmain",
"-lfreertos",
"-llwip",
"-Wl,--end-group",
"-Wl,-Tsimba.flash.4m.ld",
"-u",
"call_user_start",
Expand Down Expand Up @@ -1305,7 +1282,6 @@ BOARDS = {
"-pg",
"-fprofile-arcs",
"-ftest-coverage",
"-lgcov",
"-g",
"-Wl,-Map=build/linux/default_configuration.map",
"-Wl,--gc-sections"
Expand Down Expand Up @@ -1434,6 +1410,7 @@ BOARDS = {
"src/drivers/ports/esp32"
],
"ldflags": [
"-Wl,-Tsimba.flash.ld",
"-Wl,--cref",
"-nostdlib",
"-Wl,-EL",
Expand Down
2 changes: 1 addition & 1 deletion src/boards/photon/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ SRC += $(SIMBA_ROOT)/src/boards/photon/board.c
INC += $(SIMBA_ROOT)/3pp/wiced/WWD/include
INC += $(SIMBA_ROOT)/3pp/wiced/WWD/internal/bus_protocols/SDIO
INC += $(SIMBA_ROOT)/3pp/wiced/WWD/internal/chips/43362A2
LDFLAGS_AFTER += -lwwdsdio
LIB += wwdsdio
LIBPATH += "$(SIMBA_ROOT)/3pp/wiced/WWD/lib"

BOARD_HOMEPAGE = "https://docs.particle.io/datasheets/photon-datasheet/"
Expand Down
27 changes: 4 additions & 23 deletions src/mcus/esp32/mcu.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,9 @@ LIBPATH += "$(SIMBA_ROOT)/src/mcus/esp32/ld" \
$(ESP_IDF_ROOT)/components/newlib/lib \
$(ESP32_ROOT)/lib

LDFLAGS_AFTER += -Wl,--start-group \
$(ESPLIBS:%=-l%) \
-Wl,--end-group \
-Wl,-T$(LINKER_SCRIPT)
LDFLAGS += -Wl,-T$(LINKER_SCRIPT)

LDFLAGS_AFTER += \
$(ESPLIBS_AFTER:%=-l%)

ESPLIBS += \
LIB += \
hal \
core \
crypto \
Expand All @@ -64,16 +58,11 @@ ESPLIBS += \
nghttp \
nvs_flash \
spi_flash \
tcpip_adapter

ESPLIBS_AFTER += \
tcpip_adapter \
gcc \
g \
c_rom \
m \

# Used by arduino script to find the libraries.
LIB ?= $(ESPLIBS) $(ESPLIBS_AFTER)
m

F_CPU = 240000000

Expand All @@ -84,12 +73,4 @@ MCU_HOMEPAGE = "http://www.espressif.com"
MCU_NAME = "Espressif ESP32"
MCU_DESC = "Espressif ESP32 @ 80 MHz, 82 kB dram, 4 MB flash"

#SIZE_SUMMARY_CMD ?= $(SIMBA_ROOT)/bin/memory_usage.py \
# --ram-section .data \
# --ram-section .rodata \
# --ram-section .bss \
# --rom-section .text \
# --rom-section .irom0.text \
# ${EXE}

include $(SIMBA_ROOT)/make/$(TOOLCHAIN)/esp32.mk
35 changes: 12 additions & 23 deletions src/mcus/esp8266/mcu.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,19 @@ SRC += $(SIMBA_ROOT)/src/mcus/esp8266/mcu.c \

LIBPATH += "$(SIMBA_ROOT)/src/mcus/esp8266/ld"

LDFLAGS += -Wl,--start-group \
$(ESPLIBS:%=-l%) \
-Wl,--end-group \
-Wl,-T$(LINKER_SCRIPT)
LDFLAGS += -Wl,-T$(LINKER_SCRIPT)

LDFLAGS_AFTER += \
$(ESPLIBS_AFTER:%=-l%)

ESPLIBS += \
hal \
phy \
pp \
net80211 \
wpa \
crypto \
main \
freertos \
lwip

ESPLIBS_AFTER += \
gcc

# Used by arduino script to find the libraries.
LIB ?= $(ESPLIBS) $(ESPLIBS_AFTER)
LIB += \
hal \
gcc \
phy \
pp \
net80211 \
wpa \
crypto \
main \
freertos \
lwip

F_CPU = 80000000

Expand Down

0 comments on commit 5d724e3

Please sign in to comment.