Why is the extmod machine_mem only used in the Unix and Windows ports? It would seem to be more dangerous if used there,
and also more useful on the embedded cards, for example to examine adc or dma registers?
machine memory module
Re: machine memory module
machine_mem is used in many of the MCU ports as well (stm32, zephyr, samd, nrf, esp8266, eps32, mimxrt)
Here's some sample code that uses it:
https://github.com/dhylands/upy-example ... der.py#L14
(the stm.memXX functions and machine.memXX functions are the same thing from extmod/machine_mem.c)
Here's some sample code that uses it:
https://github.com/dhylands/upy-example ... der.py#L14
(the stm.memXX functions and machine.memXX functions are the same thing from extmod/machine_mem.c)
Re: machine memory module
Only the Unix and Windows port need to provide MICROPY_MACHINE_MEM_GET_READ_ADDR and MICROPY_MACHINE_MEM_GET_WRITE_ADDR -- the other ports get the default implementation.
Otherwise just enabling MICROPY_PY_MACHINE and adding mem8,mem16,mem32 to the port's modmachine globals table is sufficient (which as dhylands says, all the ports do).
Otherwise just enabling MICROPY_PY_MACHINE and adding mem8,mem16,mem32 to the port's modmachine globals table is sufficient (which as dhylands says, all the ports do).
-
- Posts: 30
- Joined: Mon Mar 07, 2016 11:44 pm
Re: machine memory module
Thanks for the example code and explanation