Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Cache Rules Everything Around Me

Jay Kickliter JayKickliter

💭
Cache Rules Everything Around Me
View GitHub Profile
@JayKickliter
JayKickliter / main.rs
Last active Jun 19, 2018
Runtime debugging Tock apps
View main.rs
pub unsafe fn reset_handler() {
// Lots of stuff
for (proc_num, proc_) in PROCESSES.as_ref().iter().enumerate() {
match proc_ {
Some(p) => {
load_process_hook(proc_num as u32, p.package_name, p.flash_non_protected_start() as u32)
},
None => (),
}
}
@JayKickliter
JayKickliter / fosphor_cmdline_client_ci16.diff
Created May 14, 2018
fosphor command-line app to read complex i16 samples from stdin
View fosphor_cmdline_client_ci16.diff
diff --git a/lib/fosphor/Makefile b/lib/fosphor/Makefile
index a8fb3bb..07af0e6 100644
--- a/lib/fosphor/Makefile
+++ b/lib/fosphor/Makefile
@@ -1,6 +1,6 @@
UNAME=$(shell uname)
CC=gcc
-CFLAGS=-Wall -Werror -O2 `pkg-config freetype2 glfw3 --cflags` -g
+CFLAGS=-Wall -O2 `pkg-config freetype2 glfw3 --cflags` -g
LDLIBS=`pkg-config freetype2 glfw3 --libs` -lm
View MakefileLocation.mk
# $(CURRENT_DIR) contains the location of this makefile
CURRENT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
@JayKickliter
JayKickliter / compdb.mk
Created Feb 28, 2018
Generate 'compile_commands.json' in Makefile
View compdb.mk
%.compdb_entry: %.c
@echo " {" > $@
@echo " \"command\": \"cc $(CFLAGS) $(CPPFLAGS) -c $<\"," >> $@
@echo " \"directory\": \"$(CURDIR)\"," >> $@
@echo " \"file\": \"$<\"" >> $@
@echo " }," >> $@
COMPDB_ENTRIES = $(addsuffix .compdb_entry, $(basename $(SOURCES)))
compile_commands.json: $(COMPDB_ENTRIES)
@JayKickliter
JayKickliter / tock_ffi_example.md
Last active Sep 13, 2017
Generating Tock userland header from rust source
View tock_ffi_example.md

Common rust source for both rust driver and userland code.

use core::intrinsics::transmute;

#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub enum Partnum {
    CC1121,
    CC1120,
View improved tock userland debug symbols
diff --git a/userland/Configuration.mk b/userland/Configuration.mk
index 47e5d9c8..43e41e5c 100644
--- a/userland/Configuration.mk
+++ b/userland/Configuration.mk
@@ -43,7 +43,7 @@ override ASFLAGS += -mthumb
override CFLAGS += -std=gnu11
override CPPFLAGS += \
-frecord-gcc-switches\
- -g\
+ -gdwarf-2\
@JayKickliter
JayKickliter / debugging.md
Last active Oct 23, 2017
Debugging MBed nRF52DK board with GDB
View debugging.md

Debugging nRF52DK MBed applications with GDB

Step 1 (one time only): replace MBed bootloader with JLink bootloader

  1. Power down nRF52DK
  2. Power up nRF52DK while holding down IF BOOT/RESET button
  3. Drag JLink bootloader binary to BOOTLOADER volume
  4. Power-cycle

At this point, the MBed bootloader has been replaced with JLink's.

@JayKickliter
JayKickliter / newlib_nano_links.md
Last active May 14, 2017
Guides to using Newlib-nano on bare-metal targets
View .clang-format.txt
AlignAfterOpenBracket: Align # If true, horizontally aligns arguments after an open bracket.
AlignConsecutiveAssignments: true # This will align the assignment operators of consecutive lines
AlignConsecutiveDeclarations: true # This will align the declaration names of consecutive lines
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: TopLevel
@JayKickliter
JayKickliter / Makefile
Last active May 7, 2017
GNU Make: force recompile when flags change
View Makefile
# Make OBJS depend on CPP/C/CXX/LD flags
$(OBJS): $(BUILDDIR)/flags.txt
# Creates a new flags.txt file when flags change
# make will detect this change and force a rebuild of
# all the sources
.PHONY: flags
$(BUILDDIR)/flags.txt: flags
$(Q){ \
TMP=`mktemp`; \
You can’t perform that action at this time.