Skip to content

Instantly share code, notes, and snippets.

View Scottapotamas's full-sized avatar

Scott Rapson Scottapotamas

View GitHub Profile
@Scottapotamas
Scottapotamas / create_build_info.bat
Created January 29, 2020 06:04
Generate C header defines with git tag/commit information
@rem === Batch file to generate build information from the git tag and log information.===
@rem === Get Git Build Info ===
@git describe --tags --abbrev=4 --dirty --always > tmp.txt
@set /p BUILD_INFO=<tmp.txt
@del tmp.txt
@rem -------------------------------------------------------------------
@Scottapotamas
Scottapotamas / create_build_info.sh
Created January 29, 2020 05:51
Generate C header defines with git tag/commit information
#!/usr/bin/env bash
# This is the path where we will create a C header
BUILD_INFO_FILE=./Src/app_state_machines/build_info.h
echo "Getting metadata from last local commit on current branch"
BUILD_DATE=$(git log -1 --format="%at" | xargs -I{} date -d @{} +%Y/%m/%d)
BUILD_TIME=$(git log -1 --format="%at" | xargs -I{} date -d @{} +%H:%M:%S)
BUILD_INFO=$(git describe --tags --abbrev=4 --dirty --always)
#!/bin/bash
for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
(
syspath="${sysdevpath%/dev}"
devname="$(udevadm info -q name -p $syspath)"
[[ "$devname" == "bus/"* ]] && continue
eval "$(udevadm info -q property --export -p $syspath)"
[[ -z "$ID_SERIAL" ]] && continue
echo "/dev/$devname - $ID_SERIAL"
@Scottapotamas
Scottapotamas / samd21-uuid.c
Created April 20, 2019 12:43
Get 128-bit UUID from SAMD21 micro - C (Arduino compatible)
uint32_t * get_chip_uuid()
{
static uint32_t uuid[3] = { 0 };
uuid[0] = *(volatile uint32_t *)0x0080A00C;
uuid[1] = *(volatile uint32_t *)0x0080A040;
uuid[2] = *(volatile uint32_t *)0x0080A044;
uuid[3] = *(volatile uint32_t *)0x0080A048;
return uuid;
}
@Scottapotamas
Scottapotamas / delta-control Debug.cfg
Created December 27, 2018 14:30
Modified cubemx debug configuration, uses JLink instead
# This is an delta-control board with a single STM32F429VETx chip
#
# Generated by System Workbench for STM32
# Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s)
#source [find interface/stlink.cfg]
source [find interface/jlink.cfg]
transport select swd
set WORKAREASIZE 0x8000