summaryrefslogtreecommitdiff
path: root/pcr
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2024-03-03 13:21:27 -0500
committerbill-auger <mr.j.spam.me@gmail.com>2024-03-04 21:10:34 -0500
commit171049308ee00a4389721e314038cdd2b4de4a0c (patch)
treef7ad3caad3a095dcbfcd2df986663514a7de332a /pcr
parenteae0093c0579ecdda86cf249237ae98906c4bb79 (diff)
neo6502: add package
Diffstat (limited to 'pcr')
-rw-r--r--pcr/neo6502/PKGBUILD102
-rw-r--r--pcr/neo6502/build_offline.patch134
2 files changed, 236 insertions, 0 deletions
diff --git a/pcr/neo6502/PKGBUILD b/pcr/neo6502/PKGBUILD
new file mode 100644
index 000000000..34005354b
--- /dev/null
+++ b/pcr/neo6502/PKGBUILD
@@ -0,0 +1,102 @@
+# Maintainer: bill-auger <bill-auger@programmer.net>
+
+
+pkgbase=neo6502
+pkgname=(neo6502-docs neo6502-emulator neo6502-firmware)
+_upstream_name=neo6502-firmware
+pkgver=0.16.3
+_pico_sdk_ver=1.5.1
+_tinyusb_ver=0.16.0
+_picodvi_rev=a248d72b8cc95a08b43ef4307cd954eb801272b2 # no stable release available
+_pico_fatfs_ver=1.0.8
+pkgrel=1
+pkgdesc="Emulator and firmware for the Neo6502 Retro-computer"
+arch=(armv7h i686 x86_64)
+license=(custom:MIT)
+url=http://www.neo6502.com/
+
+depends=()
+makedepends=(64tass arm-none-eabi-gcc arm-none-eabi-newlib cmake
+ python-gitpython python-pillow sdl2 zip)
+makedepends+=(pandoc texlive-latex texlive-latexextra texlive-latexrecommended)
+source=(neo6502-firmware-${pkgver}.tar.gz::https://github.com/paulscottrobson/${_upstream_name}/archive/refs/tags/v${pkgver}.tar.gz
+ pico-sdk-${_pico_sdk_ver}.tar.gz::https://github.com/raspberrypi/pico-sdk/archive/refs/tags/${_pico_sdk_ver}.tar.gz
+ tinyusb-${_tinyusb_ver}.tar.gz::https://github.com/hathach/tinyusb/archive/refs/tags/${_tinyusb_ver}.tar.gz
+ PicoDVI-${_picodvi_rev}.tar.gz::https://github.com/Wren6991/PicoDVI/archive/${_picodvi_rev}.tar.gz
+ pico_fatfs-${_pico_fatfs_ver}.tar.gz::https://github.com/carlk3/no-OS-FatFS-SD-SPI-RPi-Pico/archive/refs/tags/v${_pico_fatfs_ver}.tar.gz)
+source+=(build_offline.patch)
+sha256sums=('a935688087259743f98fb707cfcde39e9d2bf2192a77e550a71e325a43dc9c80'
+ '95f5e522be3919e36a47975ffd3b208c38880c14468bd489ac672cfe3cec803c'
+ '5b24ed6d7732d07bb25a2013b3ad65fdb8752da3e9faac6372ff0574b26a0447'
+ 'efd85ffe21335004f8ebfe6d07c2a6482c4dd96bc6f0132fa4adb21464845a88'
+ '68ffa9f157b94df969d3bc34f32acb4d4fdf2bdf5391952cf242fec20f53b0b8')
+sha256sums+=(SKIP)
+
+
+prepare()
+{
+ cd "${srcdir}"/pico-sdk-${_pico_sdk_ver}
+
+ sed -i 's|ARM_TOOLCHAIN_COMMON_FLAGS "|& -march=armv6-m -mtune=cortex-m0plus -fcf-protection=none -fstack-check=generic -fno-stack-clash-protection |' cmake/preload/toolchains/pico_arm_gcc.cmake
+
+
+ cd "${srcdir}"/${_upstream_name}-${pkgver}
+
+ # avoid downloading sources at build-time
+ patch -Np1 < "${srcdir}"/build_offline.patch
+
+ # avoid building the windows emulator
+ sed -i 's|emulator release|emulator clean\n\t$(MAKE) -B -C emulator elinux|' Makefile
+ sed -i '/neo.exe/d' release/Makefile
+
+ sed -i 's|STORAGE = USBKEY|STORAGE = NO|' firmware/Makefile
+ # prevent exit failure when sourcing cvimg.py
+ sed -i 's|sys\.exit(1)|sys.exit(0)|' basic/images/cvimg.py
+}
+
+build()
+{
+ cd "${srcdir}"/${_upstream_name}-${pkgver}
+
+ # avoid downloading sources at build-time
+ export PICO_SDK_FETCH_FROM_GIT=off
+ export PICO_SDK_PATH="${srcdir}"/pico-sdk-${_pico_sdk_ver}
+ export PICO_TINYUSB_PATH="${srcdir}"/tinyusb-${_tinyusb_ver}
+ export PICO_DVI_PATH="${srcdir}"/PicoDVI-${_picodvi_rev}
+ export PICO_FATFS_PATH="${srcdir}"/no-OS-FatFS-SD-SPI-RPi-Pico-${_pico_fatfs_ver}
+
+ make
+}
+
+package_neo6502-docs()
+{
+ cd "${srcdir}"/${_upstream_name}-${pkgver}
+
+ install -Dm644 documents/release/*.odt -t "${pkgdir}"/usr/share/doc/${pkgbase}/
+ install -Dm644 documents/release/*.pdf -t "${pkgdir}"/usr/share/doc/${pkgbase}/
+ install -Dm644 documents/*.pdf -t "${pkgdir}"/usr/share/doc/${pkgbase}/
+}
+
+package_neo6502-emulator()
+{
+ optdepends=("neo6502-docs: Neo6502 documentation")
+
+ cd "${srcdir}"/${_upstream_name}-${pkgver}
+
+ install -Dm755 bin/neo "${pkgdir}"/usr/bin/neo
+ install -d "${pkgdir}"/usr/share/${pkgbase}/examples/
+ cp -a examples/ "${pkgdir}"/usr/share/${pkgbase}/examples/
+ chmod -R 644 "${pkgdir}"/usr/share/${pkgbase}/examples/
+ install -Dm644 bin/*.zip -t "${pkgdir}"/usr/share/${pkgbase}/utils/
+ install -Dm644 LICENSE -t "${pkgdir}"/usr/share/licenses/${pkgbase}/
+}
+
+package_neo6502-firmware()
+{
+ optdepends=("neo6502-docs: Neo6502 documentation")
+
+ cd "${srcdir}"/${_upstream_name}-${pkgver}
+
+ install -Dm644 bin/*.bin -t "${pkgdir}"/usr/share/${pkgbase}/firmware/
+ install -Dm644 LICENSE -t "${pkgdir}"/usr/share/licenses/${pkgbase}/
+}
diff --git a/pcr/neo6502/build_offline.patch b/pcr/neo6502/build_offline.patch
new file mode 100644
index 000000000..66616024f
--- /dev/null
+++ b/pcr/neo6502/build_offline.patch
@@ -0,0 +1,134 @@
+diff --git a/firmware/CMakeLists.txt b/firmware/CMakeLists.txt
+index a347acf4..7c4e484e 100644
+--- a/firmware/CMakeLists.txt
++++ b/firmware/CMakeLists.txt
+@@ -3,19 +3,28 @@ cmake_minimum_required(VERSION 3.14)
+ set(CMAKE_C_STANDARD 11)
+ set(CMAKE_CXX_STANDARD 17)
+
+-set(PICO_SDK_FETCH_FROM_GIT on)
++
++if(NOT DEFINED ENV{PICO_SDK_FETCH_FROM_GIT})
++ set(PICO_SDK_FETCH_FROM_GIT on)
++ message("Defaulting PICO_SDK_FETCH_FROM_GIT")
++endif()
+ include(pico_sdk_import.cmake)
+
+ project(firmware C CXX ASM)
+
+ include(FetchContent)
+
+-FetchContent_Declare(
+- tinyusb
+- GIT_REPOSITORY https://github.com/hathach/tinyusb.git
+- GIT_TAG 0.16.0
+-)
+-FetchContent_MakeAvailable(tinyusb)
++# if((NOT DEFINED ENV{PICO_TINYUSB_FETCH_FROM_GIT}) OR ENV{PICO_TINYUSB_FETCH_FROM_GIT})
++if(DEFINED ENV{PICO_TINYUSB_PATH})
++ set(tinyusb_SOURCE_DIR $ENV{PICO_TINYUSB_PATH})
++else()
++ FetchContent_Declare(
++ tinyusb
++ GIT_REPOSITORY https://github.com/hathach/tinyusb.git
++ GIT_TAG 0.16.0
++ )
++ FetchContent_MakeAvailable(tinyusb)
++endif()
+ set(PICO_TINYUSB_PATH ${tinyusb_SOURCE_DIR})
+
+ pico_sdk_init()
+@@ -34,13 +43,18 @@ include_directories(
+ common/include
+ )
+
+-FetchContent_Declare(
+- PicoDVI
+- GIT_REPOSITORY https://github.com/Wren6991/PicoDVI
+- GIT_TAG a248d72b8cc95a08b43ef4307cd954eb801272b2 # just the latest on 11/12/2023
+-)
+-FetchContent_MakeAvailable(PicoDVI)
+-
++# if ((NOT DEFINED ENV{PICO_DVI_FETCH_FROM_GIT}) OR ENV{PICO_DVI_FETCH_FROM_GIT})
++if(DEFINED ENV{PICO_DVI_PATH})
++ set(picodvi_SOURCE_DIR $ENV{PICO_DVI_PATH})
++ set(picodvi_BINARY_DIR "_deps/picodvi-build")
++else()
++ FetchContent_Declare(
++ PicoDVI
++ GIT_REPOSITORY https://github.com/Wren6991/PicoDVI
++ GIT_TAG a248d72b8cc95a08b43ef4307cd954eb801272b2 # just the latest on 11/12/2023
++ )
++ FetchContent_MakeAvailable(PicoDVI)
++endif()
+ add_subdirectory(${picodvi_SOURCE_DIR}/software/libdvi ${picodvi_BINARY_DIR})
+
+ add_library(fatfs INTERFACE)
+@@ -54,4 +68,4 @@ target_include_directories(fatfs INTERFACE ${tinyusb_SOURCE_DIR}/lib/fatfs/sourc
+ add_subdirectory(sources)
+
+ pico_enable_stdio_usb(firmware 0)
+-pico_enable_stdio_uart(firmware 0)
+\ No newline at end of file
++pico_enable_stdio_uart(firmware 0)
+diff --git a/firmware/sources/CMakeLists.txt b/firmware/sources/CMakeLists.txt
+index a767fc49..1dd8f093 100644
+--- a/firmware/sources/CMakeLists.txt
++++ b/firmware/sources/CMakeLists.txt
+@@ -1,11 +1,16 @@
+ add_executable(firmware)
+
+-FetchContent_Declare(
+- no-OS-FatFS-SD-SPI-RPi-Pico
+- GIT_REPOSITORY https://github.com/carlk3/no-OS-FatFS-SD-SPI-RPi-Pico.git
+- GIT_TAG bbccc5d2deea09e128e2576ef35f72b473c5ba5f # just the latest on 30/01/2024
+-)
+-FetchContent_MakeAvailable(no-OS-FatFS-SD-SPI-RPi-Pico)
++if (DEFINED ENV{PICO_FATFS_PATH})
++ set(no-os-fatfs-sd-spi-rpi-pico_SOURCE_DIR $ENV{PICO_FATFS_PATH})
++ set(no-os-fatfs-sd-spi-rpi-pico_BINARY_DIR "_deps/no-os-fatfs-sd-spi-rpi-pico-build")
++else()
++ FetchContent_Declare(
++ no-OS-FatFS-SD-SPI-RPi-Pico
++ GIT_REPOSITORY https://github.com/carlk3/no-OS-FatFS-SD-SPI-RPi-Pico.git
++ GIT_TAG bbccc5d2deea09e128e2576ef35f72b473c5ba5f # just the latest on 30/01/2024
++ )
++ FetchContent_MakeAvailable(no-OS-FatFS-SD-SPI-RPi-Pico)
++endif()
+
+ pico_generate_pio_header(firmware ${CMAKE_CURRENT_LIST_DIR}/system/sm0_memory_emulation_with_clock.pio)
+
+@@ -13,26 +18,26 @@ add_definitions(-Wno-error=unused-variable)
+
+ set(COMMONSRC "../common/sources/interface")
+
+-target_sources(firmware PRIVATE main.cpp
++target_sources(firmware PRIVATE main.cpp
+ #
+ # Common ${COMMONSRC} routines
+ #
+- ${COMMONSRC}/graphics.cpp ${COMMONSRC}/console.cpp ${COMMONSRC}/keyboard.cpp ${COMMONSRC}/memory.cpp
+- ${COMMONSRC}/dispatch.cpp ${COMMONSRC}/maths.cpp ${COMMONSRC}/config.cpp ${COMMONSRC}/efla.cpp
+- ${COMMONSRC}/gfxcommands.cpp ${COMMONSRC}/ellipse.cpp ${COMMONSRC}/fileinterface.cpp
++ ${COMMONSRC}/graphics.cpp ${COMMONSRC}/console.cpp ${COMMONSRC}/keyboard.cpp ${COMMONSRC}/memory.cpp
++ ${COMMONSRC}/dispatch.cpp ${COMMONSRC}/maths.cpp ${COMMONSRC}/config.cpp ${COMMONSRC}/efla.cpp
++ ${COMMONSRC}/gfxcommands.cpp ${COMMONSRC}/ellipse.cpp ${COMMONSRC}/fileinterface.cpp
+ ${COMMONSRC}/sprites.cpp ${COMMONSRC}/logo.cpp ${COMMONSRC}/sprites_xor.cpp ${COMMONSRC}/tilemap.cpp
+ ${COMMONSRC}/sndmanager.cpp ${COMMONSRC}/sfxmanager.cpp ${COMMONSRC}/tick.cpp ${COMMONSRC}/serialmanager.cpp
+ ${COMMONSRC}/turtle.cpp ${COMMONSRC}/locale.cpp ${COMMONSRC}/pininterface.cpp
+ #
+ # Hardware sources
+ #
+- hardware/dvi_320x240x256.cpp hardware/usbdriver.cpp hardware/timer.cpp hardware/sound.cpp
++ hardware/dvi_320x240x256.cpp hardware/usbdriver.cpp hardware/timer.cpp hardware/sound.cpp
+ hardware/fileimplementation.cpp hardware/tick.cpp hardware/serial.cpp hardware/ports.cpp
+ #
+ # CPU type (pretty much permanently PIO now)
+ #
+- system/processor_pio.cpp
+- #system/processor_bitbang.cpp
++ system/processor_pio.cpp
++ #system/processor_bitbang.cpp
+ )
+
+ #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")