Skip to content

Instantly share code, notes, and snippets.

Keith Makan k3170makan

Block or report user

Report or block k3170makan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@k3170makan
k3170makan / file_opreations_finder.sh
Created May 17, 2019
Quick script for finding device file_operations structs quickly and opening them in vim
View file_opreations_finder.sh
for line in `grep --color=never * -Rnie file_operations`; do LINE=`echo $line | awk -F\: '{ print $2 }'`; FILE=`echo $line | awk -F\: '{ print $1 }'`; [ "$LINE" != "" ] && echo "[*] vim +"$LINE" $FILE"; done > vim_cmds.sh
@k3170makan
k3170makan / log.txt
Created Mar 7, 2019
example log output of successfull verilog synthesize with project icestorm for the icestick40
View log.txt
>make
yosys -p 'synth_ice40 -top top -blif example.blif' example.v
/----------------------------------------------------------------------------\
| |
| yosys -- Yosys Open SYnthesis Suite |
| |
| Copyright (C) 2012 - 2018 Clifford Wolf <clifford@clifford.at> |
| |
| Permission to use, copy, modify, and/or distribute this software for any |
View LEDBlinker.v
`default_nettype none
module top(
input clk, //clock input
output reg LED1, //LED outputs
output reg LED2,
output reg LED3,
output reg LED4,
output reg LED5
);
@k3170makan
k3170makan / icestick.pcf
Created Mar 7, 2019
Example pcf file for ICE40 FPGA board
View icestick.pcf
set_io --warn-no-port RX 9
set_io --warn-no-port TX 8
set_io LED1 99
set_io LED2 98
set_io LED3 97
set_io LED4 96
set_io LED5 95
set_io clk 21
@k3170makan
k3170makan / icemaker.sh
Created Mar 7, 2019
Cheat bash script to make setting up project icestorm tools easier
View icemaker.sh
cat /etc/lsb-release
sudo apt-get install build-essential clang bison flex libreadline-dev\
gawk tcl-dev libffi-dev git mercurial graphviz\
xdot pkg-config python python3 libftdi-dev\
qt5-default python3-dev libboost-all-dev cmake
git clone https://github.com/cliffordwolf/icestorm.git icestorm
cd icestorm
make -j$(nproc)
@k3170makan
k3170makan / Makefile
Created Mar 7, 2019
ICEStick Makefile example
View Makefile
VER=example
DEV=1k
all: $(VER).txt
icepack $(VER).txt $(VER).bin
$(VER).txt: $(VER).blif
arachne-pnr -d $(DEV) -p $(VER).pcf $(VER).blif -o $(VER).txt
$(VER).blif: $(VER).v
yosys -p 'synth_ice40 -top top -blif $(VER).blif' $(VER).v
@k3170makan
k3170makan / 1_heap.c
Last active Dec 6, 2018
Example C code for studying heap
View 1_heap.c
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
char * make_string(size_t length){
char *arr = (char *)malloc(length);
asm("int $3");
return arr;
}
void free_string(char *arr){
@k3170makan
k3170makan / never_call.c
Created Oct 23, 2018
Target binary for studying the ELF format
View never_call.c
#include <stdio.h>
void never_call(void){
printf("[*] success!! call to function never_call!!!\n\n");
}
void foo(void){
printf("[*] call to function foo\n");
return;
}
int main(int argc, char **argv){
printf("[*] call to main function\n");
@k3170makan
k3170makan / init_fini.c
Last active Oct 6, 2018
Example of a constructor function
View init_fini.c
#include <stdio.h>
void never_call(void){
printf("[*] success!! call to function never_call!!!\n\n");
}
void __attribute__ ((destructor)) foo_destructor(void){
printf("[*] hay! you called by destructor!! \n");
return;
}
void __attribute__ ((constructor)) foo_constructor(void){
printf("[*] hay! you called by constructor!! \n");
View start.S
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* This is the canonical entry point, usually the first thing in the text
segment. The SVR4/i386 ABI (pages 3-31, 3-32) says that when the entry
point runs, most registers' values are unspecified, except for:
%rdx Contains a function pointer to be registered with `atexit'.
This is how the dynamic linker arranges to have DT_FINI
functions called for shared libraries that have been loaded
You can’t perform that action at this time.