Xinyuan-LilyGO / T-PicoC3

MIT License
161 stars 43 forks source link

Latest MicroPython Compile with ST7789 Driver RP2040 #45

Closed PIBSAS closed 2 months ago

PIBSAS commented 2 months ago

T-Display PICO C3 ESP32 MicroPython

Install dependencies:

sudo apt-get update && sudo apt-get install -y gcc-arm-none-eabi libssl-dev python3 python3-pip python3-venv build-essential libffi-dev git pkg-config

Clone the nice work:

git clone https://github.com/russhughes/st7789_mpy.git

Clone MicroPython:

git clone --recurse-submodules https://github.com/micropython/micropython.git

Build MicroPython+ST7789:

cd micropython
make -C mpy-cross
cd ports/rp2
make USER_C_MODULES=../../../st7789_mpy/st7789/micropython.cmake
make submodules
make

Note: If make user line fail, change ../../../ for the full path, example: /home/your_user/st7789_mpy/st7789/micropython.cmake.

The results will be in:

micropython/ports/rp2/build-RPI_PICO/firmare.uf2

GitHub Actions workflow yaml:

name: T-Display-Pico C3

permissions:
  contents: write

on:
  push:
    tags:
     - 'v*'
  schedule:
     - cron: '0 0 * * 0'  # Se ejecutará a las 00:00 UTC cada domingo

  workflow_dispatch:  # Permite ejecutar manualmente el flujo de trabajo

jobs:
  build:
    runs-on: ubuntu-latest

    steps:

    - name: Clone Micropython
      run: git clone --recurse-submodules https://github.com/micropython/micropython.git

    - name: Clone st7789_mpy
      run: git clone https://github.com/russhughes/st7789_mpy.git

    - name: Copy tdt_config and some fonts like frozen modules
      run: |
       cp "$GITHUB_WORKSPACE/st7789_mpy/examples/configs/t-picoc3/tft_config.py" "$GITHUB_WORKSPACE/micropython/ports/rp2/modules/"
       cp "$GITHUB_WORKSPACE/st7789_mpy/examples/configs/tdisplay_rp2040/tft_buttons.py" "$GITHUB_WORKSPACE/micropython/ports/rp2/modules/"
       cp $GITHUB_WORKSPACE/st7789_mpy/examples/chango/chango.py "$GITHUB_WORKSPACE/micropython/ports/rp2/modules/"
       cp $GITHUB_WORKSPACE/st7789_mpy/examples/chango/chango_16.py "$GITHUB_WORKSPACE/micropython/ports/rp2/modules/"
       cp $GITHUB_WORKSPACE/st7789_mpy/examples/chango/chango_32.py "$GITHUB_WORKSPACE/micropython/ports/rp2/modules/"
       cp $GITHUB_WORKSPACE/st7789_mpy/examples/chango/chango_64.py "$GITHUB_WORKSPACE/micropython/ports/rp2/modules/"
       cp $GITHUB_WORKSPACE/st7789_mpy/fonts/vector/*.py "$GITHUB_WORKSPACE/micropython/ports/rp2/modules/"
       cp $GITHUB_WORKSPACE/st7789_mpy/fonts/truetype/*.py "$GITHUB_WORKSPACE/micropython/ports/rp2/modules/"
       cp $GITHUB_WORKSPACE/st7789_mpy/fonts/bitmap/*.py "$GITHUB_WORKSPACE/micropython/ports/rp2/modules/"

    - name: Install dependencies
      run: |
       sudo apt-get update
       sudo apt-get install -y gcc-arm-none-eabi libssl-dev python3 python3-pip python3-venv build-essential libffi-dev git pkg-config

    - name: Build MicroPython for RP2040
      run: |
        cd micropython
        make -C mpy-cross
        cd ports/rp2
        make USER_C_MODULES=$GITHUB_WORKSPACE/st7789_mpy/st7789/micropython.cmake
        make submodules
        make

    - name: Move .uf2 files to artifacts
      run: |
        mkdir -p ./artifacts
        cp micropython/ports/rp2/build-RPI_PICO/*.uf2 ./artifacts/RP2040.uf2

    - name: Generate Tag
      id: tag
      run: echo "TAG_NAME=release-$(date +'%Y%m%d-%H%M')" >> $GITHUB_ENV

    - name: Create Release
      uses: marvinpinto/action-automatic-releases@latest
      with:
        repo_token: "${{ secrets.GITHUB_TOKEN }}"
        prerelease: false
        automatic_release_tag: ${{ env.TAG_NAME }} 
        title: "Release for version ${{ env.TAG_NAME }}"
        files: ./artifacts/*
PIBSAS commented 2 months ago

just for share!. Update Github Actions step to include tft_config.py and tft_buttons.py from st7789_mpy repo, so we no need to lost flash space on those mandatory files, plus added fonts too, so when we upload examples from repo they will work. The Create Release need someone with more knwledge to make look better but works and we will have the latest micropython and the latest driver ST7789.