Skip to content

Instantly share code, notes, and snippets.

View wolfmanjm's full-sized avatar

Jim Morris wolfmanjm

View GitHub Profile
@wolfmanjm
wolfmanjm / multicore.s
Created June 19, 2025 18:02
multicore.s
# -----------------------------------------------------------------------------
Definition Flag_visible, "execute-coprocessor"
execute_coprocessor: # ( xt -- ) Entry point for the coprocessor trampoline
# -----------------------------------------------------------------------------
# Store the execution token into a global variable
li x14, trampolineaddr # Note we are using li here as we forcefully circumvent the linker facilities
sw x8, 0(x14)
drop
@wolfmanjm
wolfmanjm / multicore.s
Created June 18, 2025 22:19
multicore
# -----------------------------------------------------------------------------
# Initialize register file
# li x1, 0 # Return address register, holds link back and is also used to compose long calls with auipc and jalr
# laf x2, returnstackanfang # Set return stack pointer (sp)
# li x3, 0 # Loop index
# li x4, 0 # Loop limit
# li x5, 0 # Scratch register, needs to be saved.
# li x6, 0 # Scratch register, needs to be saved.
# li x7, 0 # Scratch register, needs to be saved.
@wolfmanjm
wolfmanjm / upload.py
Created May 30, 2025 09:56
upload for swd2
#! /usr/bin/python3
# this script will concatenate the file specified into the upload.fs
# it strips comments and handles #require
#
import argparse
import os
import re
import sys
File.foreach('RP2350.svd') do |line|
if line.include?('<bitRange>')
# Extract range from <bitRange>[31:0]</bitRange>
range_match = line.match(/\[(\d+):(\d+)\]/)
if range_match
hr = range_match[1].to_i
lr = range_match[2].to_i
puts "<bitOffset>#{lr}</bitOffset>"
puts "<bitWidth>#{(hr - lr) + 1}</bitWidth>"
end
@wolfmanjm
wolfmanjm / startup.s
Last active March 23, 2025 13:19
bare metal riscv on pico2
.section .text
.global _start
.equ SYSCTL_BASE, 0x40000000
.equ CLK_EN_REG, SYSCTL_BASE + 0x100 # Clock enable register
.equ PAD_ISO_REG, 0x40038000 + 0x40 # Pad isolation control register for GPIO15
.equ IOMUX_BASE, 0x40028000
.equ IOMUX_GPIO15, IOMUX_BASE + 0x7C # IOMUX register for GPIO15
@wolfmanjm
wolfmanjm / swd-readline.py
Last active March 12, 2025 20:16
swd2 frontend for line editing and history
#! /usr/bin/python -u
import subprocess
import selectors
import os
import time
import readline
import sys
import atexit
import threading
@wolfmanjm
wolfmanjm / feeders.ini
Created July 30, 2024 11:46
button box ini
[button box]
feeder0.pin = PE8 # button
feeder0.press = echo -1 M700N0 # command to send
feeder1.pin = PJ7 # button
feeder1.press = echo -1 M700N1 # command to send
feeder2.pin = PJ8 # button
feeder2.press = echo -1 M700N2 # command to send
import matplotlib.pyplot as plt
x0=0 # First Position (Start)
xd=100 # Second Position (End)
T=100 # Time
x= [0] * 101
for t in range(0,101):
x[t]= x0+(xd-x0)*(10*((t/T)**3)-15*((t/T)**4)+6*((t/T)**5))
G1 X0.000000 Y0.000000 E0.000000
G1 X0.000149 Y0.008564 E0.100000
G1 X0.000598 Y0.017119 E0.200000
G1 X0.001345 Y0.025659 E0.300000
G1 X0.002390 Y0.034176 E0.400000
G1 X0.003732 Y0.042661 E0.500000
G1 X0.005371 Y0.051107 E0.600000
G1 X0.007306 Y0.059507 E0.700000
G1 X0.009536 Y0.067852 E0.800000
G1 X0.012058 Y0.076134 E0.900000
; 20mm cylinder with 0.3mm height 0.7mm width volumetric E
G92 E0
G1 X-10 Z0.3 F3000
G2 I10 J0 E11.98
G10
G1 Z0.6
G11
G92 E0
G2 I10 J0 E11.98
G10