Skip to content

Instantly share code, notes, and snippets.

@elfmimi
elfmimi / rp2040.py
Created November 26, 2023 10:13
pyOCD user script for RP2040
# pyOCD user script
# 'usb_boot' command will put target RP2040 into bootloader mode
#
# Howto invoke:
# pyocd cmd --script rp2040.py -c usb_boot
options.update({
"target_override": "rp2040",
})
@elfmimi
elfmimi / R7FA4M1AB-testing.yaml
Last active July 28, 2023 15:53
probe-rs chip-description for RA4M1 / R7FA4M1AB
name: R7FA4M1AB-testing
variants:
- name: R7FA4M1AB-testing
cores:
- name: main
type: armv7em
core_access_options: !Arm
ap: 0
psel: 0
memory_map:
@elfmimi
elfmimi / ra-util.py
Created July 17, 2023 08:33
pyOCD user script to erase sector0 of flash memory for RA4M1 / R7FA4M1AB
# pyocd cmd --script ra-util.py -c "erase_sector0"
from pyocd.core.exceptions import TransferFaultError, TransferTimeoutError
if not "target_override" in options:
options.set("target_override", "cortex_m")
# options.set("target_override", "R7FA4M1AB")
if not "frequency" in options:
options.set("frequency", 12500000)
@elfmimi
elfmimi / CredReadTest.ps1
Last active May 3, 2023 15:33
POC: PowerShell script to retrieve your access token from Windows Credential Manager
# Howto execute this script:
# Unblock-File .\CredReadTest.ps1
# powershell -ExecutionPolicy RemoteSigned .\CredReadTest.ps1
#
# The following command displays a list of credentials:
# cmdkey /list
Write-Output "CredRead Test Program"
$type_def = @'
@elfmimi
elfmimi / README.md
Created February 3, 2023 14:58
Old patch for OpenSK targeting Raytac MDBT50Q-RX dongle

Old patch for OpenSK targeting Raytac MDBT50Q-RX dongle

The revision I tried was the Initial commit (f91d2fd) .

OpenSK is using Tock as one of its submodules.

So you need to clone OpenSK and its submodules recursively.

After you have cloned it successfully, you should be able to find this directory.

@elfmimi
elfmimi / Makefile
Last active December 26, 2022 14:15
Makefile for NUC123BSP ISP_HID sample
TARGET=ISP_HID
NUC123BSP=../../../../../GitHub/Nuvoton-NUC123BSP
CMSISDIR=$(NUC123BSP)/Library/CMSIS
DEVICEDIR=$(NUC123BSP)/Library/Device/Nuvoton/NUC123
DRIVERDIR=$(NUC123BSP)/Library/StdDriver
SAMPLEDIR=$(NUC123BSP)/SampleCode/ISP/ISP_HID
INCS=-I.
INCS+= -I$(SAMPLEDIR)
@elfmimi
elfmimi / convert_matrix_config.py
Last active July 11, 2022 13:18
Port of ruby script convert_matrix_config.rb in python.
#!/usr/bin/env python3
# Copyright 2022 Takeshi Ishii (@mtei)
# Copyright 2022 Ein Terakawa (a_p_u_r_o@elfmimi)
# SPDX-License-Identifier: GPL-2.0-or-later
import sys
import re
import json
import subprocess
@elfmimi
elfmimi / MCU-Link + DAPLink firmware
Last active June 18, 2022 14:15
Comparison of lsusb output between MCU-Link + DAPLink vs Orbtrace-mini
@elfmimi
elfmimi / reset-usb-sbc.sh
Last active December 18, 2022 07:34
Reset Linux USB subsystem without rebooting
#!/bin/bash
# root privilege required
if cd /sys/bus/platform/drivers/ehci-platform >& /dev/null; then
for dev in *.usb; do
echo -n $dev > unbind
echo -n $dev > bind
done
fi
@elfmimi
elfmimi / nuvoton.py
Last active May 27, 2023 14:00
pyOCD user script for Nuvoton ARM MCUs
# How to invoke:
# pyocd cmd --script nuvoton.py -c "ident"
# pyocd cmd --script nuvoton.py -c "read_config_regs"
# pyocd cmd --script nuvoton.py -c "write_config_regs 0xFFFFFFFF 0xFFFFFFFF"
# pyocd cmd --script nuvoton.py -c "chip_erase"
#
# and for the commander prompt, invoke it like this:
# pyocd cmd --script nuvoton.py
from pyocd.core.exceptions import TransferFaultError, TransferTimeoutError