Skip to content

Instantly share code, notes, and snippets.

View kylemanna's full-sized avatar

Kyle Manna kylemanna

View GitHub Profile
@kylemanna
kylemanna / gist:1367672
Created November 15, 2011 17:20
Relocate ELF binary file for use with JTAG debugging
#!/bin/sh
# Following command will relocate the linux kernel elf file from
# 0xc000_0000 to 0x8000_0000 which coincides with the actual load
# address on TI OMAP3 platforms.
# This should also work for debugging the second stage of u-boot
# after it has been relocated
arm-none-linux-gnueabi-objcopy --change-addresses -0x40000000 vmlinux vmlinux.2
@kylemanna
kylemanna / gist:1376913
Created November 18, 2011 16:16
Reverse endianess on a binary file
#!/bin/sh
# Following command will reorder 32 bit words from little endian to big endian
#
# This is needed on TI81xx platforms to convert a standard LE bootloader/SPL/MLO
# to a byte ordering the works via SPI flash
arm-none-linux-gnueabi-objcopy -Ibinary --reverse-bytes=4 MLO MLO.spi
# Output:
# $ hexdump -C MLO | head -n2
@kylemanna
kylemanna / am3505-enable-gpt9.sh
Created November 25, 2011 16:44
Enable GPT9 PWM on AM3505/AM3517
#!/bin/sh
# Enable functional and interface clocks for gpt9 (bit 10)
devmem2 0x48005000 w 0x00000c00
devmem2 0x48005010 w 0x0003Ec00
# Zero pwm
devmem2 0x49040024 w 0
# Switch to gpt9_pwm_evt in mux
@kylemanna
kylemanna / test_tim5_pwm.sh
Created November 25, 2011 20:49
Test TIM5 PWM on a TI8148
#!/bin/sh
#
# This generates a test PWM that should be ~ 1.2kHz @ 75% +duty cycle
# on TI8148 boards with the default timer clock source
#
# Parse devmem2 output
get_devmem2() {
devmem2 $1 w | grep "^Read" | sed -e "s/.*:\s*//"
}
@kylemanna
kylemanna / gist:1402533
Created November 28, 2011 23:09
U-Boot + TI8148 EVM + TIM7 PWM
# U-Boot + TI8148 EVM + TIM7 PWM
# 75% +Duty Cycle, 1.221 kHz, 3.3Vpp
# Measure @ RA11.4 or RA11.5
# Mux
mw.l 0x48140ac8 0x60040
# Config
base 0x4804a000
mw.l 0x40 0xFFFFc000
mw.l 0x4c 0xFFFFf000
mw.l 0x44 1
@kylemanna
kylemanna / gist:1402545
Created November 28, 2011 23:14
U-Boot + TI8148 EVM + TIM7 Counter/Capture
# U-Boot + TI8148 EVM + TIM7 Counter/Capture
# Short RA11.4/RA11.5 to 3.3V @ C177
# Mux (pull-up doesn't work in TIM7 MUXMODE)
mw.l 0x48140ac8 0x60040
# Config
base 0x4804a000
mw.l 0x40 0
mw.l 0x44 1
# Start
mw.l 0x38 0x00303
@kylemanna
kylemanna / time-test.c
Created April 5, 2012 21:29
Simple timer for an ugly loop
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <sched.h>
#include <string.h>
double diff(struct timespec *start, struct timespec *end)
{
struct timespec temp;
if ((end->tv_nsec-start->tv_nsec)<0) {
@kylemanna
kylemanna / gist:2485494
Created April 25, 2012 01:59
AT&T USBConnect Shockwave 4G
Welcome to minicom 2.6.1
OPTIONS: I18n
Compiled on Apr 24 2012, 20:51:15.
Port /dev/ttyUSB2
Press CTRL-A Z for help on special keys
at
OK
@kylemanna
kylemanna / pydevmem.py
Created June 22, 2012 20:16
[HACK] Dump AM387x/TI81848 PHY registers
#!/usr/bin/env python
"""
This is designed primarily for use with accessing /dev/mem on OMAP platforms.
It should work on other platforms and work to mmap() files rather then just
/dev/mem, but these use cases aren't well tested.
All file accesses are aligned to DevMem.word bytes, which is 4 bytes on ARM
platforms to avoid data abort faults when accessing peripheral registers.
References:
@kylemanna
kylemanna / build-copy.sh
Created July 13, 2012 19:12
Script to build compat-wireless and the kernel and copy it to a target
#!/bin/sh
export CLIENT=client
export KLIB_BUILD=/ssd/sandbox/${CLIENT}/oe/arago-tmp/sysroots/ti814x-evm-angstrom-linux-gnueabi/kernel
export KLIB_BUILD={$HOME}/go/${CLIENT}/linux-omap3
export INSTALL_MOD_PATH=/nfsroots/${CLIENT}
export KLIB=${INSTALL_MOD_PATH}
export DESTDIR=${INSTALL_MOD_PATH}
export DEPMOD=echo
export LDFLAGS=""
export RSYNC_PASSWORD=""