diff --git a/Makefile b/Makefile index 28641a9..d326c7d 100644 --- a/Makefile +++ b/Makefile @@ -241,79 +241,79 @@ $(GEN): $(GEN)/posix_boot.h: posix/posix_boot.fs | $(GEN) ./tools/importation.py -i $< -o $@ \ - -I . -I $(GEN) --name boot --header cpp --depsout $@.dd \ + -I . -I $(OUT) --name boot --header cpp --depsout $@.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/posix_boot.h.dd $(GEN)/windows_boot_extra.h: windows/windows_boot_extra.fs | $(GEN) ./tools/importation.py -i $< -o $@ \ - -I . -I $(GEN) --name boot_extra --header win --depsout $@.dd \ + -I . -I $(OUT) --name boot_extra --header win --depsout $@.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/windows_boot_extra.h.dd $(GEN)/windows_boot.h: windows/windows_boot.fs | $(GEN) ./tools/importation.py -i $< -o $@ \ - -I . -I $(GEN) --name boot --header win --depsout $@.dd \ + -I . -I $(OUT) --name boot --header win --depsout $@.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/windows_boot.h.dd $(GEN)/pico_ice_boot.h: pico-ice/pico_ice_boot.fs | $(GEN) ./tools/importation.py -i $< -o $@ \ - -I . -I $(GEN) --name boot --header cpp --depsout $@.dd \ + -I . -I $(OUT) --name boot --header cpp --depsout $@.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/pico_ice_boot.h.dd $(GEN)/esp32_boot.h: esp32/esp32_boot.fs | $(GEN) ./tools/importation.py -i $< -o $@ \ - -I . -I $(GEN) --name boot --header cpp --depsout $@.dd \ + -I . -I $(OUT) --name boot --header cpp --depsout $@.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/esp32_boot.h.dd $(GEN)/esp32_assembler.h: common/assembler.fs | $(GEN) ./tools/importation.py -i $< -o $@ \ - -I . -I $(GEN) --name assembler_source --header cpp --depsout $@.dd \ + -I . -I $(OUT) --name assembler_source --header cpp --depsout $@.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/esp32_assembler.h.dd $(GEN)/esp32_xtensa-assembler.h: esp32/optional/assemblers/xtensa-assembler.fs | $(GEN) ./tools/importation.py -i $< -o $@ \ - -I . -I $(GEN) --name xtensa_assembler_source --header cpp --depsout $@.dd \ + -I . -I $(OUT) --name xtensa_assembler_source --header cpp --depsout $@.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/esp32_xtensa-assembler.h.dd $(GEN)/esp32_riscv-assembler.h: esp32/optional/assemblers/riscv-assembler.fs | $(GEN) ./tools/importation.py -i $< -o $@ \ - -I . -I $(GEN) --name riscv_assembler_source --header cpp --depsout $@.dd \ + -I . -I $(OUT) --name riscv_assembler_source --header cpp --depsout $@.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/esp32_riscv-assembler.h.dd $(GEN)/esp32_camera.h: esp32/optional/camera/camera_server.fs | $(GEN) ./tools/importation.py -i $< -o $@ \ - -I . -I $(GEN) --name camera_source --header cpp --depsout $@.dd \ + -I . -I $(OUT) --name camera_source --header cpp --depsout $@.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/esp32_camera.h.dd $(GEN)/esp32_interrupts.h: esp32/optional/interrupts/timers.fs | $(GEN) ./tools/importation.py -i $< -o $@ \ - -I . -I $(GEN) --name interrupts_source --header cpp --depsout $@.dd \ + -I . -I $(OUT) --name interrupts_source --header cpp --depsout $@.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/esp32_interrupts.h.dd $(GEN)/esp32_oled.h: esp32/optional/oled/oled.fs | $(GEN) ./tools/importation.py -i $< -o $@ \ - -I . -I $(GEN) --name oled_source --header cpp --depsout $@.dd \ + -I . -I $(OUT) --name oled_source --header cpp --depsout $@.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/esp32_oled.h.dd $(GEN)/esp32_spi-flash.h: esp32/optional/spi-flash/spi-flash.fs | $(GEN) ./tools/importation.py -i $< -o $@ \ - -I . -I $(GEN) --name spi_flash_source --header cpp --depsout $@.dd \ + -I . -I $(OUT) --name spi_flash_source --header cpp --depsout $@.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/esp32_spi-flash.h.dd $(GEN)/esp32_serial-bluetooth.h: esp32/optional/serial-bluetooth/serial-bluetooth.fs | $(GEN) ./tools/importation.py -i $< -o $@ \ - -I . -I $(GEN) --name serial_bluetooth_source --header cpp --depsout $@.dd \ + -I . -I $(OUT) --name serial_bluetooth_source --header cpp --depsout $@.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/esp32_serial-bluetooth.h.dd @@ -349,7 +349,7 @@ $(GEN)/web_sys.js: $(GEN)/dump_web_opcodes | $(GEN) $(GEN)/web_boot.js: web/web_boot.fs | $(GEN) ./tools/importation.py -i $< -o $@ \ - -I . -I $(GEN) --name boot --header web --depsout $@.dd \ + -I . -I $(OUT) --name boot --header web --depsout $@.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/web_boot.js.dd @@ -450,7 +450,7 @@ $(WINDOWS)/uEf32.obj: \ windows/main.c \ $(GEN)/windows_boot_extra.h \ $(GEN)/windows_boot.h | $(WINDOWS) - ./tools/importation.py -i $< -o $@ --no-out -I . -I $(GEN) --depsout $@.dd + ./tools/importation.py -i $< -o $@ --no-out -I . -I $(OUT) --depsout $@.dd $(CL32) /c /Fo$@ $(WIN_CFLAGS) $< -include $(WINDOWS)/uEf32.obj.dd @@ -463,7 +463,7 @@ $(WINDOWS)/uEf64.obj: \ windows/main.c \ $(GEN)/windows_boot_extra.h \ $(GEN)/windows_boot.h | $(WINDOWS) - ./tools/importation.py -i $< -o $@ --no-out -I . -I $(GEN) --depsout $@.dd + ./tools/importation.py -i $< -o $@ --no-out -I . -I $(OUT) --depsout $@.dd $(CL64) /c /Fo$@ $(WIN_CFLAGS) $< -include $(WINDOWS)/uEf64.obj.dd @@ -511,7 +511,7 @@ $(ESP32)/ESP32forth/ESP32forth.ino: \ $(GEN)/esp32_boot.h | $(ESP32)/ESP32forth ./tools/importation.py -i $< -o $@ \ --keep-first-comment \ - -I . -I $(GEN) --depsout $(GEN)/esp32.dd \ + -I . -I $(OUT) --depsout $(GEN)/esp32.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/esp32.dd @@ -531,7 +531,7 @@ $(ESP32)/ESP32forth/optional/assemblers.h: \ $(GEN)/esp32_riscv-assembler.h | $(ESP32)/ESP32forth/optional ./tools/importation.py -i $< -o $@ \ --keep-first-comment \ - -I . -I $(GEN) --depsout $(GEN)/esp32_optional_assemblers.h.dd \ + -I . -I $(OUT) --depsout $(GEN)/esp32_optional_assemblers.h.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/esp32_optional_assemblers.h.dd @@ -540,7 +540,7 @@ $(ESP32)/ESP32forth/optional/camera.h: \ $(GEN)/esp32_camera.h | $(ESP32)/ESP32forth/optional ./tools/importation.py -i $< -o $@ \ --keep-first-comment \ - -I . -I $(GEN) --depsout $(GEN)/esp32_optional_camera.h.dd \ + -I . -I $(OUT) --depsout $(GEN)/esp32_optional_camera.h.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/esp32_optional_camera.h.dd @@ -549,7 +549,7 @@ $(ESP32)/ESP32forth/optional/interrupts.h: \ $(GEN)/esp32_interrupts.h | $(ESP32)/ESP32forth/optional ./tools/importation.py -i $< -o $@ \ --keep-first-comment \ - -I . -I $(GEN) --depsout $(GEN)/esp32_optional_interrupts.h.dd \ + -I . -I $(OUT) --depsout $(GEN)/esp32_optional_interrupts.h.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/esp32_optional_interrupts.h.dd @@ -558,7 +558,7 @@ $(ESP32)/ESP32forth/optional/oled.h: \ $(GEN)/esp32_oled.h | $(ESP32)/ESP32forth/optional ./tools/importation.py -i $< -o $@ \ --keep-first-comment \ - -I . -I $(GEN) --depsout $(GEN)/esp32_optional_oled.h.dd \ + -I . -I $(OUT) --depsout $(GEN)/esp32_optional_oled.h.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/esp32_optional_oled.h.dd @@ -573,7 +573,7 @@ $(ESP32)/ESP32forth/optional/serial-bluetooth.h: \ $(GEN)/esp32_serial-bluetooth.h | $(ESP32)/ESP32forth/optional ./tools/importation.py -i $< -o $@ \ --keep-first-comment \ - -I . -I $(GEN) --depsout $(GEN)/esp32_optional_serial-bluetooth.h.dd \ + -I . -I $(OUT) --depsout $(GEN)/esp32_optional_serial-bluetooth.h.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/esp32_optional_serial-bluetooth.h.dd @@ -582,7 +582,7 @@ $(ESP32)/ESP32forth/optional/spi-flash.h: \ $(GEN)/esp32_spi-flash.h | $(ESP32)/ESP32forth/optional ./tools/importation.py -i $< -o $@ \ --keep-first-comment \ - -I . -I $(GEN) --depsout $(GEN)/esp32_optional_spi-flash.h.dd \ + -I . -I $(OUT) --depsout $(GEN)/esp32_optional_spi-flash.h.dd \ -DVERSION=$(VERSION) -DREVISION=$(REVISION) -include $(GEN)/esp32_optional_spi-flash.h.dd diff --git a/esp32/optional/assemblers/assemblers.h b/esp32/optional/assemblers/assemblers.h index 4cd68b6..28c94a9 100644 --- a/esp32/optional/assemblers/assemblers.h +++ b/esp32/optional/assemblers/assemblers.h @@ -24,7 +24,7 @@ PUSH assembler_source; PUSH sizeof(assembler_source) - 1) \ PLATFORM_ASSEMBLER_SUPPORT -#include "esp32_assembler.h" +#include "gen/esp32_assembler.h" #if defined(__riscv) @@ -32,7 +32,7 @@ XV(internals, "riscv-assembler-source", RISCV_ASSEMBLER_SOURCE, \ PUSH riscv_assembler_source; PUSH sizeof(riscv_assembler_source) - 1) -#include "esp32_riscv-assembler.h" +#include "gen/esp32_riscv-assembler.h" #else @@ -40,6 +40,6 @@ XV(internals, "xtensa-assembler-source", XTENSA_ASSEMBLER_SOURCE, \ PUSH xtensa_assembler_source; PUSH sizeof(xtensa_assembler_source) - 1) -#include "esp32_xtensa-assembler.h" +#include "gen/esp32_xtensa-assembler.h" #endif diff --git a/esp32/optional/camera/camera.h b/esp32/optional/camera/camera.h index 477c399..f920ae2 100644 --- a/esp32/optional/camera/camera.h +++ b/esp32/optional/camera/camera.h @@ -31,4 +31,4 @@ YV(camera, esp_camera_save_to_nvs, n0 = esp_camera_save_to_nvs(c0)) \ YV(camera, esp_camera_load_from_nvs, n0 = esp_camera_load_from_nvs(c0)) -#include "esp32_camera.h" +#include "gen/esp32_camera.h" diff --git a/esp32/optional/interrupts/interrupts.h b/esp32/optional/interrupts/interrupts.h index fa75649..04c6b6c 100644 --- a/esp32/optional/interrupts/interrupts.h +++ b/esp32/optional/interrupts/interrupts.h @@ -154,4 +154,4 @@ static cell_t TimerIsrCallbackAdd(cell_t group, cell_t timer, cell_t xt, cell_t return timer_isr_callback_add((timer_group_t) group, (timer_idx_t) timer, HandleInterruptAndRet, args, flags); } -#include "esp32_interrupts.h" +#include "gen/esp32_interrupts.h" diff --git a/esp32/optional/oled/oled.h b/esp32/optional/oled/oled.h index 785e6da..92e0a07 100644 --- a/esp32/optional/oled/oled.h +++ b/esp32/optional/oled/oled.h @@ -55,4 +55,4 @@ static Adafruit_SSD1306 *oled_display = 0; YV(oled, OledRectR, oled_display->drawRoundRect(n5, n4, n3, n2, n1, n0); DROPn(5)) \ YV(oled, OledRectRF, oled_display->fillRoundRect(n5, n4, n3, n2, n1, n0 ); DROPn(5)) -#include "esp32_oled.h" +#include "gen/esp32_oled.h" diff --git a/esp32/optional/serial-bluetooth/serial-bluetooth.h b/esp32/optional/serial-bluetooth/serial-bluetooth.h index b9638c7..45ee380 100644 --- a/esp32/optional/serial-bluetooth/serial-bluetooth.h +++ b/esp32/optional/serial-bluetooth/serial-bluetooth.h @@ -47,4 +47,4 @@ /* Bluetooth */ \ YV(bluetooth, esp_bt_dev_get_address, PUSH esp_bt_dev_get_address()) -#include "esp32_serial-bluetooth.h" +#include "gen/esp32_serial-bluetooth.h" diff --git a/esp32/optional/spi-flash/spi-flash.h b/esp32/optional/spi-flash/spi-flash.h index 9204337..1238114 100644 --- a/esp32/optional/spi-flash/spi-flash.h +++ b/esp32/optional/spi-flash/spi-flash.h @@ -77,4 +77,4 @@ n0 = esp_partition_check_identity((const esp_partition_t *) a1, \ (const esp_partition_t *) a0); NIP) -#include "esp32_spi-flash.h" +#include "gen/esp32_spi-flash.h" diff --git a/tools/configure.py b/tools/configure.py index 0710df0..46777bc 100755 --- a/tools/configure.py +++ b/tools/configure.py @@ -27,8 +27,8 @@ REVISION = 'TODO' CFLAGS_COMMON = [ '-O2', - '-I', './', '-I', '$src', + '-I', './', ] CFLAGS_MINIMIZE = [ @@ -98,7 +98,7 @@ rule mkdir rule importation description = importation depfile = $out.dd - command = ../tools/importation.py -i $in -o $out -I . -I $src $options --depsout $depfile -DVERSION=$version -DREVSION=$revision + command = ../tools/importation.py -i $in -o $out -I . -I $src $options --depsout $depfile -DVERSION=$version -DREVISION=$revision build gen: mkdir build posix: mkdir @@ -130,61 +130,32 @@ def Importation(target, source, header_mode='cpp', name=None, keep=False, deps=N if deps: output += f' depfile = {deps}\n' -def Esp32Optional(target, c_source, header, name, forth_source): - Importation(target, name, forth_source) - Importation('gen/' + header, name, forth_source) +def Esp32Optional(main_name, main_source, parts): + for name, source in parts: + Importation('gen/esp32_' + name + '.h', + source, name=name.replace('-', '_') + '_source') + if not main_source: + main_source = 'gen/esp32_' + main_name + '.h' + Importation('esp32/ESP32forth/optional/' + main_name + '.h', + main_source, + keep=True, + deps='gen/esp32_optional_' + main_name + '.h.dd', + implicit=['gen/esp32_' + i + '.h' for i, _ in parts]) -Importation('gen/esp32_assembler.h', - '$src/common/assembler.fs', name='assembler_source') -Importation('gen/esp32_xtensa-assembler.h', - '$src/esp32/optional/assemblers/xtensa-assembler.fs', name='xtensa_assembler_source') -Importation('gen/esp32_riscv-assembler.h', - '$src/esp32/optional/assemblers/riscv-assembler.fs', name='riscv_assembler_source') -Importation('esp32/ESP32forth/optional/assemblers.h', - '$src/esp32/optional/assemblers/assemblers.h', - deps='gen/esp32_optional_assemblers.h.dd', - implicit=[ - 'gen/esp32_assembler.h', - 'gen/esp32_xtensa-assembler.h', - 'gen/esp32_riscv-assembler.h', - ]) - -Importation('gen/esp32_camera.h', - '$src/esp32/optional/camera/camera_server.fs', name='camera_source') -Importation('esp32/ESP32forth/optional/camera.h', - 'gen/esp32_camera.h', - deps='gen/esp32_optional_camera.h.dd', - implicit=['gen/esp32_camera.h']) - -Importation('gen/esp32_interrupts.h', - '$src/esp32/optional/interrupts/timers.fs', name='interrupts_source') -Importation('esp32/ESP32forth/optional/interrupts.h', - 'gen/esp32_interrupts.h', - deps='gen/esp32_optional_interrupts.h.dd', - implicit=['gen/esp32_interrupts.h']) - -Importation('gen/esp32_oled.h', - '$src/esp32/optional/oled/oled.fs', name='oled_source') -Importation('esp32/ESP32forth/optional/oled.h', - 'gen/esp32_oled.h', - deps='gen/esp32_optional_oled.h.dd', - implicit=['gen/esp32_oled.h']) - -Importation('gen/esp32_spi-flash.h', - '$src/esp32/optional/spi-flash/spi-flash.fs', - name='spi_flash_source') -Importation('esp32/ESP32forth/optional/spi-flash.h', - 'gen/esp32_spi-flash.h', - deps='gen/esp32_optional_spi-flash.h.dd', - implicit=['gen/esp32_spi-flash.h']) - -Importation('gen/esp32_serial-bluetooth.h', - '$src/esp32/optional/serial-bluetooth/serial-bluetooth.fs', - name='serial_bluetooth_source') -Importation('esp32/ESP32forth/optional/serial-bluetooth.h', - 'gen/esp32_serial-bluetooth.h', - deps='gen/esp32_optional_serial-bluetooth.h.dd', - implicit=['gen/esp32_serial-bluetooth.h']) +Esp32Optional('assemblers', '$src/esp32/optional/assemblers/assemblers.h', + [('assembler', '$src/common/assembler.fs'), + ('xtensa-assembler', '$src/esp32/optional/assemblers/xtensa-assembler.fs'), + ('riscv-assembler', '$src/esp32/optional/assemblers/riscv-assembler.fs')]) +Esp32Optional('camera', '$src/esp32/optional/camera/camera.h', + [('camera', '$src/esp32/optional/camera/camera_server.fs')]) +Esp32Optional('interrupts', '$src/esp32/optional/interrupts/interrupts.h', + [('interrupts', '$src/esp32/optional/interrupts/timers.fs')]) +Esp32Optional('oled', '$src/esp32/optional/oled/oled.h', + [('oled', '$src/esp32/optional/oled/oled.fs')]) +Esp32Optional('spi-flash', '$src/esp32/optional/spi-flash/spi-flash.h', + [('spi-flash', '$src/esp32/optional/spi-flash/spi-flash.fs')]) +Esp32Optional('serial-bluetooth', '$src/esp32/optional/serial-bluetooth/serial-bluetooth.h', + [('serial-bluetooth', '$src/esp32/optional/serial-bluetooth/serial-bluetooth.fs')]) Importation('gen/posix_boot.h', '$src/posix/posix_boot.fs', name='boot') Importation('gen/window_boot.h', '$src/windows/windows_boot.fs', header_mode='win', name='boot')