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
| /****************************************************************************/ | |
| /* LNK.CMD */ | |
| /* */ | |
| /* Usage: clpru <src files...> -z -o <out file> -m <map file> lnk.cmd */ | |
| /* */ | |
| /* Description: This file is a sample command file that can be used */ | |
| /* for linking programs built with the PRU C */ | |
| /* Compiler. Use it as a guideline; you may want to change */ | |
| /* the allocation scheme according to the size of your */ | |
| /* program and the memory layout of your target system. */ |
| #ifndef PRU_DEFS_H | |
| #define PRU_DEFS_H | |
| volatile register unsigned int __R31; | |
| volatile register unsigned int __R30; | |
| __far int C0 __attribute((cregister("MEM", far))); | |
| __far int C4 __attribute((cregister("MEM", far))); | |
| /* |
| # 1 "test.c" | |
| # 1 "<built-in>" | |
| # 1 "<command-line>" | |
| # 1 "test.c" | |
| # 1 "/usr/include/stdio.h" 1 3 4 | |
| # 28 "/usr/include/stdio.h" 3 4 | |
| # 1 "/usr/include/features.h" 1 3 4 | |
| # 324 "/usr/include/features.h" 3 4 | |
| # 1 "/usr/include/i386-linux-gnu/bits/predefs.h" 1 3 4 | |
| # 325 "/usr/include/features.h" 2 3 4 |
| .file "test.c" | |
| .section .rodata | |
| .LC0: | |
| .string "%d" | |
| .text | |
| .globl main | |
| .type main, @function | |
| main: | |
| .LFB0: | |
| .cfi_startproc |
| 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\ |
| 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 |
| ___________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 | |
| * |
| import pru_speak | |
| botspeak_code = \ | |
| ''' SET DIO[0] , 1 | |
| WAIT 1 | |
| SET DIO[0], 0 | |
| WAIT 1 | |
| GOTO 0''' | |
| pru_speak.load(botspeak_code) |
| /* | |
| * 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/; |