Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: compile & stash

on:
push:
branches:
- 'development'
- 'devel/*'

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
board: [BOARD_HIDPICO_REV2, BOARD_HIDPICO_REV4]
build-type: [Release, Debug]

steps:
- name: Additional dependencies
run: |
sudo apt-get update
sudo apt-get install -y make gcc-arm-none-eabi

- name: Get the source
uses: actions/checkout@v6
with:
submodules: recursive

- name: Run cmake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -DBOARD_TYPE=${{matrix.board}}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build-type}}

- name: Copy build artifacts to output
run: |
_destdir="output-${{matrix.build-type}}-${{matrix.board}}"
mkdir -p "${_destdir}"
if test "${{github.ref_type}}" = "tag"; then
_build_id="${{github.ref_name}}"
else
_build_id="${{github.sha}}"
fi
_destfile_prefix="amigahid-pico-${{matrix.build-type}}-${{matrix.board}}-${_build_id}"
cp -v "build/src/amigahid-pico.elf" "${_destdir}/${_destfile_prefix}.elf"
cp -v "build/src/amigahid-pico.uf2" "${_destdir}/${_destfile_prefix}.uf2"

- name: Upload artifacts for build
uses: actions/upload-artifact@v7
with:
name: output-${{matrix.build-type}}-${{matrix.board}}
path: output-*

merge:
runs-on: ubuntu-latest
needs: build
steps:
- name: Combine build matrix
uses: actions/upload-artifact/merge@v7
with:
name: output-${{github.sha}}
pattern: output-*
delete-merged: true
16 changes: 15 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ set(ENV{PICO_SDK_PATH} "${CMAKE_SOURCE_DIR}/pico-sdk/")
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)

# amigahid-pico build target; see src/config.h BOARD_* defines; default to rev4
if (NOT BOARD_TYPE)
set(BOARD_TYPE BOARD_HIDPICO_REV4)
endif ()

# which chip/pico board version is being used; unfortunately this can't be driven by config.h so needs to be set here
if (NOT PICO_PLATFORM)
set(PICO_PLATFORM rp2040)
endif ()
if (NOT PICO_BOARD)
set(PICO_BOARD pico)
endif ()

# use sdk from git submodule
include(pico-sdk/pico_sdk_init.cmake)

project(amigahid-pico C CXX ASM)
Expand All @@ -16,7 +30,7 @@ add_compile_options(-Wall -Werror)
add_compile_definitions(DEBUG_MESSAGES=1)

# set the board revision (changes which pins are mapped to which ports)
add_compile_definitions(HIDPICO_REVISION=4)
add_compile_definitions(${BOARD_TYPE})

# debugging for tinyusb - be warned that it can cause timing issues causing things to break
# add_compile_definitions(CFG_TUSB_DEBUG=2)
Expand Down
24 changes: 0 additions & 24 deletions bin/95cc299/README.md

This file was deleted.

Binary file removed bin/95cc299/rev4/amigahid-pico.elf
Binary file not shown.
Binary file removed bin/95cc299/rev4/amigahid-pico.uf2
Binary file not shown.
73 changes: 0 additions & 73 deletions cmake/pico_sdk_import.cmake

This file was deleted.

24 changes: 20 additions & 4 deletions doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## configuration

open [CMakeLists.txt](/CMakeLists.txt) and look for the configuration options. comment and uncomment as needed.
the file [CMakeLists.txt](/CMakeLists.txt) has a small number of configuration options. the critical aspects of the build can be specified on the `cmake` commandline; you should not normally need to edit the [CMakeLists.txt](/CMakeLists.txt) file unless you are doing something outlandish.

## building the source code

Expand All @@ -16,16 +16,32 @@ $ git submodule update --init --recursive

the tinyusb component of the pico-sdk has a lot of its own submodules so this could take some time.

when it's ready, start cmake off:
when it's ready, start cmake off; you'll need to specify the board type you're using. if you omit it, you'll get a build for the default target, amigahid-pico standard pcb revision 4. this is akin to running:

```shell
$ cmake -B build/ -S .
$ cmake -B build/ -S . -DBOARD_HIDPICO_REV4
```

but you can also run this to get a revision 2 pcb build (the pin assignments are different):

```shell
$ cmake -B build/ -S . -DBOARD_HIDPICO_REV2
```

at present there are only two targets, revision 2 and revision 4. revision 3 users should not use the pcb as it has a faulty pin assignment which can spontaneously reset the rp2040 controller, so please do not use it.

you can also enable generation of debug symbols so as to use `openocd` and `gdb` to debug a running target over serial-wire debug (swd). to do this, add the parameter `-DCMAKE_BUILD_TYPE=Debug`, e.g.:

```shell
$ cmake -B build/ -S . -DBOARD_HIDPICO_REV4 -DCMAKE_BUILD_TYPE=Debug
```

a 'Release' build is generated by default.

then build:

```shell
$ cd build && make
$ cd build && cmake --build build/
```

see next section for installing on a pico.
Expand Down
20 changes: 14 additions & 6 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@
#ifndef _CONFIG_H
#define _CONFIG_H

#ifndef HIDPICO_REVISION
# define HIDPICO_REVISION 4
#endif

// the pico has an onboard led on gp25; use this as a default indicator
#ifndef INDICATOR_LED
# define INDICATOR_LED PICO_DEFAULT_LED_PIN
#endif

#if HIDPICO_REVISION == 2
#if defined(BOARD_HIDPICO_REV2)
# define HAS_SCREEN
# define HAS_KEYBOARD
# define HAS_PORT1
# define HAS_PORT2

# define I2C_PORT i2c0
# define I2C_PIN_SDA 4
# define I2C_PIN_SCL 5
Expand All @@ -39,7 +40,12 @@
# define QM1_AMIGA_B1 22
# define QM1_AMIGA_B2 26
# define QM1_AMIGA_B3 27
#elif HIDPICO_REVISION == 4
#elif defined(BOARD_HIDPICO_REV4)
# define HAS_SCREEN
# define HAS_KEYBOARD
# define HAS_PORT1
# define HAS_PORT2

# define I2C_PORT i2c1
# define I2C_PIN_SDA 2
# define I2C_PIN_SCL 3
Expand All @@ -56,6 +62,8 @@
# define QM1_AMIGA_B1 11
# define QM1_AMIGA_B2 12
# define QM1_AMIGA_B3 13
#else
# error Board type has not been defined; check cmake command line
#endif

#endif // _CONFIG_H