Can I add “functions code” to core of CircuitPython?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- erik2019
- Posts: 29
- Joined: Tue Aug 21, 2018 1:30 am
Can I add “functions code” to core of CircuitPython?
When you build your function for your chip in CircuitPython you add it for example to the main file. But can I add the “function” code when I build the core CircuitPython, if so how?
- neradoc
- Posts: 542
- Joined: Wed Apr 27, 2016 2:38 pm
Re: Can I add “functions code” to core of CircuitPython?
Hi, what do you want to do exactly ? What is the final goal ? And what board are you using ?
If you want to be able to deploy some prepared python code to a board, there are a few ways you can do that.
On RP2040 for example, you can save the content of the flash as a UF2 with picotool, and use that to deploy the same code to another identical board.
In Circuitpython the firmware and the user code are separated, but python code can be added into the core, known as "frozen modules", but it might not be what you want to do, depending on your end goal. We mostly use it to embed libraries on boards that have a small amount of drive and RAM space, since frozen modules are "pre-processed" into a smaller format, and run from the flash (whereas use code needs to be loaded in RAM).
If you want to be able to deploy some prepared python code to a board, there are a few ways you can do that.
On RP2040 for example, you can save the content of the flash as a UF2 with picotool, and use that to deploy the same code to another identical board.
In Circuitpython the firmware and the user code are separated, but python code can be added into the core, known as "frozen modules", but it might not be what you want to do, depending on your end goal. We mostly use it to embed libraries on boards that have a small amount of drive and RAM space, since frozen modules are "pre-processed" into a smaller format, and run from the flash (whereas use code needs to be loaded in RAM).
Please be positive and constructive with your questions and comments.