From 94feabe652e29360e9e39981894a1a1a1d0dd458 Mon Sep 17 00:00:00 2001 From: Peter McGoron Date: Wed, 13 Jul 2022 12:07:03 -0400 Subject: [PATCH] add software --- software/CMakeLists.txt | 7 +++++++ software/Kconfig | 3 +++ software/mk.sh | 7 +++++++ software/prj.conf | 3 +++ software/src/main.c | 23 +++++++++++++++++++++++ 5 files changed, 43 insertions(+) create mode 100644 software/CMakeLists.txt create mode 100644 software/Kconfig create mode 100755 software/mk.sh create mode 100644 software/prj.conf create mode 100644 software/src/main.c diff --git a/software/CMakeLists.txt b/software/CMakeLists.txt new file mode 100644 index 0000000..b7c40a4 --- /dev/null +++ b/software/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr) +project(cryosnom1) +include_directories("../firmware") + +target_sources(app PRIVATE src/main.c) diff --git a/software/Kconfig b/software/Kconfig new file mode 100644 index 0000000..1f47670 --- /dev/null +++ b/software/Kconfig @@ -0,0 +1,3 @@ +mainmenu "CryoSNOM 1" + +source "Kconfig.zephyr" diff --git a/software/mk.sh b/software/mk.sh new file mode 100755 index 0000000..efa3a0d --- /dev/null +++ b/software/mk.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -x + +mkdir -p build +cd build +cmake $(cat ../../firmware/overlay.config) -DDTC_OVERLAY_FILE=../firmware/overlay.dts -DBOARD=litex_vexriscv .. && make -j7 diff --git a/software/prj.conf b/software/prj.conf new file mode 100644 index 0000000..1186b44 --- /dev/null +++ b/software/prj.conf @@ -0,0 +1,3 @@ +CONFIG_LOG=y +CONFIG_LOG_BUFFER_SIZE=1024 +CONFIG_LOG_PRINTK=y diff --git a/software/src/main.c b/software/src/main.c new file mode 100644 index 0000000..032fa68 --- /dev/null +++ b/software/src/main.c @@ -0,0 +1,23 @@ +#include +#include +#include +#include "pin_io.h" + +void +main(void) +{ + uint32_t out_pins = 0; + uint32_t in_pin; + + LOG_PRINTK("hello, world\n"); + for (;;) { + k_sleep(K_MSEC(1000)); + *dac_ctrl[0] = out_pins; + out_pins++; + if (out_pins == 7) + out_pins = 0; + in_pin = *dac_miso[0]; + + LOG_PRINTK("out: %d; in: %d\n", out_pins, in_pin); + } +}