Skip to content

Instantly share code, notes, and snippets.

View tstellanova's full-sized avatar
💭
growing excited

Todd Stellanova tstellanova

💭
growing excited
View GitHub Profile
#!/bin/bash
#
# Lock GPU and MEM clocks to max MHz
#
# - benchmarking shows there is no need to override the MEM clock
#
echo
echo Locking GPU clock to max MHz for debugging porpoises...
# set to max
@tstellanova
tstellanova / howto_sdcard_jetson.md
Last active August 29, 2015 14:05
Howto mount sdcard on Jetson TK1

sudo mkdir -p /mnt/sdcard
sudo mount  /dev/mmcblk1p1 /mnt/sdcard

This will only allow root user to write. To allow sudoers to write, edit /etc/fstab:

#include <SDKDDKVer.h>
#include <Windows.h>
#pragma warning(disable:4819)
#pragma warning(disable:4996)
// for OpenCV2
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/gpu/gpu.hpp"
[ 3737.049861] Unhandled fault: imprecise external abort (0x1406) at 0x00000000
[ 3737.057007] Internal error: : 1406 [#1] PREEMPT SMP ARM
[ 3737.062292] Modules linked in: dm_crypt ath9k ath9k_common ath9k_hw rfcomm bnep rtc_as3722 ath bluetooth mac80211 parport_pc parport cfg80211 rfkill nvhost_vi
[ 3737.076803] CPU: 0 PID: 622 Comm: NetworkManager Not tainted 3.10.24-grinch-19.3.6 #5
[ 3737.084725] task: eb0905c0 ti: edc98000 task.ti: edc98000
[ 3737.090190] PC is at ath9k_ioread32+0x38/0x78 [ath9k]
[ 3737.095303] LR is at ath9k_hw_wait+0x74/0xa4 [ath9k_hw]
[ 3737.100588] pc : [<bea0ffb8>]    lr : [<be9a8734>]    psr: 80070093
#!/bin/bash
#
# Lock GPU and MEM clocks to max MHz
#
# - benchmarking shows there is no need to override the MEM clock
#
echo
echo "Current GPU:" $[ $(</sys/kernel/debug/clock/gbus/rate) / 1000000] MHz
echo
echo Locking GPU clock to max MHz for debugging porpoises...
@tstellanova
tstellanova / jetson_setup_packages.sh
Last active August 29, 2015 14:06
Script to setup Jetson tk1 development environment
#!/bin/bash
#
# install all essential dev packages
sudo apt-get update
sudo apt-get install -y build-essential locate keychain git cmake cmake-curses-gui libv4l-dev v4l-utils python-numpy python-scipy libavformat-dev libpng-dev libjpeg-dev libtiff-dev libswscale-dev libeigen3-dev libtbb-dev libgtk2.0-dev
sudo dpkg -i /mnt/sdcard/cuda-repo-l4t-r19.2_6.0-42_armhf.deb
# make apt aware of the package you downloaded
sudo apt-get update
@tstellanova
tstellanova / Jetson_tk1_setup2.md
Last active August 29, 2015 14:06
Setup Jetson tk1 -- new instructions

Before you begin, ensure that you've setup network access, either with ethernet or wlan.

Setup timezone

sudo dpkg-reconfigure tzdata

Typically we use "US/Pacific-New"

Mount sdcard

@tstellanova
tstellanova / trapezoid_numeric_integration.c
Last active August 29, 2015 14:09
trap rule numeric integration
static void integrate_gyro(FlowData_t* flow_data)
{
uint8_t idx = flow_data->gyro_integ_idx;
if (idx >= NUM_GYRO_INTEG_STEPS) {
//shuffle newer data down to oldest buckets
size_t buck_size = sizeof(flow_data->gyro_x_traps[0]);
size_t total_size = (NUM_GYRO_INTEG_STEPS -1)*buck_size;
memcpy( (flow_data->gyro_x_traps), (flow_data->gyro_x_traps + buck_size), total_size);
@tstellanova
tstellanova / LockfreeQueue.hpp
Created March 13, 2015 20:09
Lockfree queue using only C++0x features (g++ 4.6)
/**
* A lock-free queue for sharing messages across threads
* Requires C++0x but nothing later (as many current such things do)
* ref: Herb Sutter, "A Corrected One-Producer, One-Consumer Lock-Free Queue"
* http://www.drdobbs.com/parallel/writing-lock-free-code-a-corrected-queue/210604448
*/
template <typename T>
class LockFreeQueue {
#include <uuid/uuid.h>
#include <time.h>
#include <stdio.h>
#include <ctime>
int main(void)
{
uuid_t blob = {};
clock_t startTime = clock();