Hi,
i'm just reading several month now and always find good information for my problems.
But now i just browsed thru all the information here, but i didn't find any solution.
First let me describe the background.
I'm working on a good implementation of the TPS (https://www.elektronik-labor.de/Lernpak ... /TPS0.html, sry site only availble in german, an english introduction you can find here: https://www.elektronik-labor.de/Literatur/MyCo.html) on the RPI Pico booard. I already written many other implementations, like the Arduino Uno/Nano, ATTiny, ESP8266, ESP32, Microbit, caliope...
TPS/myco is a simple 4-Bit interpreter, with the possibility of programming them via 2 buttons. The TPS is often used for smaller automation purposes. Especially for beginners and people with little programming knowledge. There is also a small introduction to this on my page: https://wkla.no-ip.biz/ArduinoWiki/doku ... arduinosps
As I said, the users have little to no knowledge of controller programming, and therefore little experience of how to set up the RPI Pico with micropython.
I am now looking for a way to automatethe installtion, e.g. with a small program or script, on the one hand to install the MicroPython image on the RPI Pico, and also the TPS interpreter.
Preferably without further installation of other components. Operating system is 99% Windows.
So the individual operations would be:
- Start board with BOTSEL, script searches for drive
- script copies mycropython image
- restart
- script searches for new COM port
- script copies main.py
- restart
Is there already something ready for this task?
setup new board, upload py file
Re: setup new board, upload py file
You can download the MicroPython source code, place your 'main.py' in the 'modules' directory of the 'rp2' port, rebuild MicroPython and you will end up with a 'firmware.uf2' which can be loaded with your 'main.py' pre-installed. With a little more effort you can make that 'tps.py' and have it auto-run at start-up, create 'pico-tps.uf2' rather than 'formware.uf2'.
That will reduce the issue to how to get the '.uf2' on to the board when it is connected.
Re: setup new board, upload py file
Hi,
thanks for the hint.
Today i try this approach and had success.
Now i can build my own uf2 firmware file with my embedded py file.
I do this on Windows with a little help from Docker Desktop. Here are my steps for other to reproduce:
First install, if not already done, docker desktop
Than start a ubuntu image with an interactive shell
In this shell we have to install some packages for the build process
Now we can clone the micropython repo
After that we have to build mpy-cross
Now in windows we can copy from the host maschine our *.py file to
Our last step is to build the firmware
After that you can copy from build-PICO the firmware.uf2 file to the desired firmware file.
thanks for the hint.
Today i try this approach and had success.
Now i can build my own uf2 firmware file with my embedded py file.
I do this on Windows with a little help from Docker Desktop. Here are my steps for other to reproduce:
First install, if not already done, docker desktop
Than start a ubuntu image with an interactive shell
Code: Select all
docker run -it -v [your mount path on your windows maschine, eg c:\temp\ubuntu]:/var/host ubuntu /bin/bash
Code: Select all
apt-get install git
apt-get install gcc-arm-none-eabi libstdc++-arm-none-eabi-newlib libnewlib-arm-none-eabi
apt-get install build-essential
apt-get install cmake
apt-get install python3
Code: Select all
cd /var/host
git clone https://github.com/micropython/micropython.git
git submodule update --init lib/mbedtls
Code: Select all
cd micropython
make -C mpy-cross
cd ..
Code: Select all
ports/rp2/modules.
Code: Select all
cd ports/rp2
make submodules
make clean
make
Re: setup new board, upload py file
In general, rather than putting your code in the modules directory, you should define your own board definition. This allows you to write a manifest file which you can use to reference whichever files you want to be included in your firmware.
(It's more initial work, but the idea is that your board definition can be maintained outside of the main repository).
(It's more initial work, but the idea is that your board definition can be maintained outside of the main repository).