add software

This commit is contained in:
Peter McGoron 2022-07-13 12:07:03 -04:00
parent 675e4adc27
commit 94feabe652
5 changed files with 43 additions and 0 deletions

7
software/CMakeLists.txt Normal file
View File

@ -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)

3
software/Kconfig Normal file
View File

@ -0,0 +1,3 @@
mainmenu "CryoSNOM 1"
source "Kconfig.zephyr"

7
software/mk.sh Executable file
View File

@ -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

3
software/prj.conf Normal file
View File

@ -0,0 +1,3 @@
CONFIG_LOG=y
CONFIG_LOG_BUFFER_SIZE=1024
CONFIG_LOG_PRINTK=y

23
software/src/main.c Normal file
View File

@ -0,0 +1,23 @@
#include <zephyr/zephyr.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#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);
}
}