allow file name for TRG= setting; update docs

This commit is contained in:
Michal Moskal 2022-07-07 16:10:43 -07:00
Родитель 6d70a51ed5
Коммит e3948fa6c0
2 изменённых файлов: 14 добавлений и 13 удалений

Просмотреть файл

@ -154,19 +154,19 @@ which can be flashed with any software, in this case `built/touch-sensor-1.0/com
* [create a new repo](https://github.com/microsoft/jacdac-module-template/generate) from `jacdac-module-template`; * [create a new repo](https://github.com/microsoft/jacdac-module-template/generate) from `jacdac-module-template`;
let's say the new repo is called `jacdac-acme-corp-modules` let's say the new repo is called `jacdac-acme-corp-modules`
* update `jacdac-stm32` and `jacdac-c` submodules (eg., with `make update-submodules`) * update `jacdac-stm32` and `jacdac-c` submodules (eg., with `make update-submodules`)
* copy `targets/_example/` to `targets/acme-corp-buzzer-v1.0/` (replaceing `acme-corp-buzzer-v1.0` with the name of the module or series of modules) * copy `targets/_example/` to `targets/buzzer-v1.0/` (replacing `buzzer-v1.0` with the name of the module or series of modules)
* edit [targets/acme-corp-buzzer-v1.0/board.h](targets/_example/board.h) to match your module * edit [targets/buzzer-v1.0/board.h](targets/_example/board.h) to match your module
* you likely do not need to edit [targets/acme-corp-buzzer-v1.0/config.mk](targets/_example/config.mk), * you likely do not need to edit [targets/buzzer-v1.0/config.mk](targets/_example/config.mk),
unless using F0 chip unless using F0 chip
* edit [targets/acme-corp-buzzer-v1.0/profile/module.c](targets/_example/profile/module.c) * edit [targets/buzzer-v1.0/profile/module.c](targets/_example/profile/module.c)
to include your module name and used services (follow comments in `module.c`); to include your module name and used services (follow comments in `module.c`);
see [jd_services.h](https://github.com/microsoft/jacdac-c/blob/master/services/jd_services.h) see [jd_services.h](https://github.com/microsoft/jacdac-c/blob/master/services/jd_services.h)
for list of services for list of services
* rename `module.c` to match the type of module (eg. `servo.c`) * rename `module.c` to match the type of module (eg. `buzzer.c`)
* if you have several modules with non-conflicting `board.h` definitions, * if you have several modules with non-conflicting `board.h` definitions,
you can create more files under `targets/acme-corp-buzzer-v1.0/profile/`; you can create more files under `targets/buzzer-v1.0/profile/`;
otherwise you'll need to create `targets/acme-corp-thermocouple-v1.0` or something similar otherwise you'll need to create `targets/thermocouple-v1.0` or something similar
* edit `Makefile.user` to set `TRG`, eg. `TRG = acme-corp-buzzer-v1.0 servo` * edit `Makefile.user` to set `TRG`, eg. `TRG = targets/buzzer-v1.0/profile/buzzer.c`
* run `make`; this will generate a new unique identifier and place as an argument of `FIRMWARE_IDENTIFIER` macro * run `make`; this will generate a new unique identifier and place as an argument of `FIRMWARE_IDENTIFIER` macro
* make sure to never change the firmware identifier number, as that will break future firmware updates * make sure to never change the firmware identifier number, as that will break future firmware updates
@ -175,8 +175,8 @@ If you copy `targets/jm-*/profiles/something.c` from
set the `FIRMWARE_IDENTIFIER` to `0` (the one in `targets/_examples` already has it set to `0`). set the `FIRMWARE_IDENTIFIER` to `0` (the one in `targets/_examples` already has it set to `0`).
This way, the build process will generate a new firmware identifier. This way, the build process will generate a new firmware identifier.
Now, edit `DROP_TARGETS` in `Makefile` to only include your `acme-corp-buzzer-v1.0` folder Now, edit `DROP_TARGETS` in `Makefile` to only include your `buzzer-v1.0` folder
(and in future `acme-corp-thermocouple-v1.0` etc.). (and in future `thermocouple-v1.0` etc.).
Make sure to remove the string `acme-corp-button` from `DROP_TARGETS`. Make sure to remove the string `acme-corp-button` from `DROP_TARGETS`.
When you run `make drop` now, you should get a `.uf2` file combining firmware for all your modules. When you run `make drop` now, you should get a `.uf2` file combining firmware for all your modules.

Просмотреть файл

@ -1,10 +1,11 @@
ifneq ($(TRG),) ifneq ($(TRG),)
TARGET := $(word 1,$(TRG)) TRG0 := $(subst /profile/, ,$(TRG))
PROF := $(word 2,$(TRG)) TARGET := $(subst targets/,,$(word 1,$(TRG0)))
PROF := $(word 2,$(TRG0:.c=))
endif endif
ifeq ($(TARGET),) ifeq ($(TARGET),)
$(error Define 'TRG = jm-v2.0 npx' or similar, best in Makefile.user) $(error Define 'TRG = targets/buzzer-v1.0/profile/buzzer.c' or similar, best in Makefile.user)
endif endif
FORCE ?= FORCE ?=