Skip to content

Instantly share code, notes, and snippets.

View deepakkarki's full-sized avatar
🎯
Focusing

Deepak Karki deepakkarki

🎯
Focusing
View GitHub Profile
/*
* Copyright (C) 2013 Pantelis Antoniou <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/dts-v1/;
/plugin/;
Initializing PRU Speak
ps>SET var, 2
...
len(p) : 5
[0]
ps>SET var1, 3
...
len(p) : 5
[3]
ps>Closing terminal
Disassembly of pru0_firmware.obj:
DATA Section .data (Little Endian), 0x14 bytes at 0x0
00000000 shm_base:
00000000 00000000 .word 0x00000000
00000004 single_command:
00000004 00000000 .word 0x00000000
00000008 inst_pointer:
00000008 00000000 .word 0x00000000
/*instruction set encoding */
#define NOP 0
/*SET RES[x], y - IO operations*/
#define SET_DIO_a 1
#define SET_DIO_b 2
#define SET_DIO_c 3
#define SET_PWM_a 4
#define SET_PWM_b 5
#define SET_PWM_c 6
@deepakkarki
deepakkarki / BB-BONE-PRU-07
Created July 15, 2014 02:08
DTS for PRU Speak
/*
* Copyright (C) 2013 Pantelis Antoniou <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/dts-v1/;
/plugin/;

SET

CMD   A     VALA     B     VALB  
0000 0000 0000 0000 0000 0000 0000 0000
\  / \  / \       / \  / \       / \  / 
SET  DIO      5     VAR      4   ignored
  • A,B are one of DIO, AO, PWM, TMR, user variable, value
@deepakkarki
deepakkarki / pru_api.py
Created June 10, 2014 17:19
1st iteration of the PRU Speak API
import pru_speak
botspeak_code = \
''' SET DIO[0] , 1
WAIT 1
SET DIO[0], 0
WAIT 1
GOTO 0'''
pru_speak.load(botspeak_code)
___________C Code - user space______________
int *src = (int *)mmap (NULL, 4096, PROT_READ, MAP_SHARED, m_fd, 0);
___________Kernel space driver_______________
/*
*
* BIN FILE SYSFS - for mmap'ing. share mem b/w userspace, kernel and PRU
*
ELF\00\00\00\00\00\00\00\00\00\00\00\00\00\000\834\00\00\00<\00\00\00\00\00\004\00 \00 \00(\00\00\00\00\00\004\00\00\004\804\80 \00\00 \00\00\00\00\00\00\00\00\00\00\00T\00\00T\81T\81\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\80\00\80\FC\00\00\FC\00\00\00\00\00\00\00\00\00\00\00\00\00\9F\9F\00\00\00\00\00\00\00\00\00\00\00\00\00\00(\00\00(\9F(\9F\C8\00\00\00\C8\00\00\00\00\00\00\00\00\00\00\00\00h\00\00h\81h\81D\00\00\00D\00\00\00\00\00\00\00\00\00P\E5td\00\00\85\854\00\00\004\00\00\00\00\00\00\00\00\00Q\E5td\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00R\E5td\00\00\9F\9F\EC\00\00\00\EC\00\00\00\00\00\00\00\00\00/lib/ld-linux.so.2\00\00\00\00\00\00\00\00\00\00\00GNU\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00GNU\00\B6\B4\ADV\B2f\E3qv0\87V]?\00\00\00\00\00\00\00\00\00\00\00\00\00 \00 \00\00\00\00\00\00\00\ADK\E3\C0\00\00\00\00
ELF\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00<\00\00\00\00\00\004\00\00\00\00\00(\00
\00
\00U\89\E5\83\E4\F0\83\EC \C7D$\00\00\00\C7D$\00\00\00\8BD$\8BT$ЉD$\B8\00\00\00\00\8BT$\89T$\89$\E8\FC\FF\FF\FF\C9\C3\00\00%d\00\00GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3\00\00\00\00\00\00\00\00\00\00zR\00| \88\00\00\00\00\00\00\00\00\00\00\00\00>\00\00\00\00A\85B
z\C5 \00\00\00.symtab\00.strtab\00.shstrtab\00.rel.text\00.data\00.bss\00.rodata\00.comment\00.note.GNU-stack\00.rel.eh_frame\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\004\00\00\00>\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00 \00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00 \00\00\00\00\00\00\00\00\00\00\00\00%\00\00\00\00\00\00\00\00\00\00\00\00\00t\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00+\00\00\00\00\00\00\00\00\00\00\00\