zephyr: Add per board customization of modmachine. - #18846
#18846zephyr: Add per board customization of modmachine.#18846ant9000 wants to merge 1 commit intomicropython:mastermicropython/micropython:masterfrom ant9000:pr/zephyr/modmachine_board_includefileant9000/micropython:pr/zephyr/modmachine_board_includefileCopy head branch name to clipboard
Conversation
Signed-off-by: Antonio Galea <antonio.galea@gmail.com>
I'm curious what you mean by "logically pertain"? The idea with the The recommended way for a board to add functionality is through additional modules that it defines (and documents). They can be modules implemented in C or Python (or both). |
Well, I'm implementing I figured out a way to include my code in the most unintrusive way I could think of, that still allows me to use |
OK. In that case maybe a better solution is for your board definition to enable Ideally |
That's what I did, actually. I was just trying to implement precisely those functions for my specific board.
I see your point: my customization opens up
I get the point, but low power modes vary wildly from board to board. Zephyr PM support is very flexible, but also much more difficult to tame (to be expected, building a generic solution instead of a specific one is harder).
Well, I'm embassassed to admit that I missed it entirely 😊 That's what I tried to implement myself in my first attempt, only to find out that enabling CONFIG_PM and CONFIG_PM_DEVICE for Zephyr makes the console unusable on my board (quite likely it's not marked active at boot). This also happens with a Zephyr-only project unless I also add CONFIG_PM_DEVICE_RUNTIME, but that does not work correctly in MicroPython. In any case, for my specific board it's not enough to power off the console - the system timers keep the CPU active, and All in all, the "all boards implementation" provided won't work as expected on my board - and I'm pretty sure on others too. |
|
also possibly relevant: |
|
Thanks @dpgeorge , @Josverl for pointing me to a much better way to solve my problem. I've managed to produce a working Zephyr-only (thus hopefully generic) solution for My code just adds a few lines to #18199 - I opened a PR on @bikeNomad 's repo with my changes (I'm unsure of how you manage this kind of stuff, it seemed sensible to maintain the original attribution). |
I'm implementing a few board specific functions that logically pertain to
modmachine.c, for a board catered by the generic Zephyr port.The proposed change implements a way to add board-level customization, using an include file, by adding a new
#defineto your build:I've also added another customization, a
MICROPY_PY_MACHINE_BOARD_EXTRA_GLOBALSmacro that is appended toMICROPY_PY_MACHINE_EXTRA_GLOBALS.This change only adds a customization path, it's transparent to current code.