from old backup
This commit is contained in:
parent
3021cadd95
commit
b5ce18e826
70
compile.sh
Normal file
70
compile.sh
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
#/bin/sh
|
||||||
|
|
||||||
|
CUR_DIR=$(pwd)
|
||||||
|
|
||||||
|
# config
|
||||||
|
DEVICE=MSP430G2553
|
||||||
|
OUT_DIR=$CUR_DIR/out
|
||||||
|
MAIN_FILE=$CUR_DIR/main.c
|
||||||
|
|
||||||
|
# GCC directorys
|
||||||
|
GCC_DIR=$HOME/ti/gcc
|
||||||
|
GCC_BIN_DIR=$GCC_DIR/bin
|
||||||
|
GCC_ELF_INC=$GCC_DIR/msp430-elf/include
|
||||||
|
GCC_MSP_INC=$GCC_DIR/include
|
||||||
|
GCC_LD=$GCC_MSP_INC/$(echo $DEVICE | tr A-Z a-z).ld
|
||||||
|
|
||||||
|
# comands
|
||||||
|
CC=$GCC_BIN_DIR/msp430-elf-gcc
|
||||||
|
|
||||||
|
# optionsh
|
||||||
|
|
||||||
|
# -O optimizer; -O0: no optimization, -O1: level 1, -O2: level 2, -O3: level 3, -Os: size, -Ofast: speed, -OG: debug experiance
|
||||||
|
# -D <name>[=<value>] define; <name>: the name of the defination, <value>: the value for de definition defaults to 1
|
||||||
|
# -mmcu=<muc> muc name
|
||||||
|
# -g add debug information for GDB
|
||||||
|
# -ffunction-sections a specific optimisation thing
|
||||||
|
# -fdata-sections a specific optimisation thing
|
||||||
|
# -T <file> add linker script (dl file)
|
||||||
|
# -L <dir> add source directory for libraries(-l<lib> serches for a librarie)
|
||||||
|
# -Wl,--gc-sections enable that specific optimisation thing mansiont by -ffunction-sections and -fdata-sections
|
||||||
|
# -I <dir> adds directory to the search list for header files
|
||||||
|
|
||||||
|
# original cmd
|
||||||
|
# -Os -mmcu=${DEVICE} -g -ffunction-sections -fdata-sections -D __${DEVICE}__ -D DEPRECATED
|
||||||
|
# my version
|
||||||
|
# -Og -mmcu=${DEVICE} -g -D __${DEVICE}__
|
||||||
|
|
||||||
|
# original cmd
|
||||||
|
# -T ${GCC_LD} -L ${GCC_MSP_INC} -mmcu=${DEVICE} -g -Wl,--gc-sections
|
||||||
|
# my version
|
||||||
|
# -T ${GCC_LD} -L ${GCC_MSP_INC} -mmcu=${DEVICE} -g
|
||||||
|
|
||||||
|
# my complete version
|
||||||
|
# -Og -mmcu=${DEVICE} -g -D__${DEVICE}__ -T ${GCC_LD} -L ${GCC_MSP_INC} -I ${GCC_MSP_INC} -I ${GCC_ELF_INC}
|
||||||
|
|
||||||
|
MYFLAGS="-Og -mmcu=${DEVICE} -g -D__${DEVICE}__ -T ${GCC_LD} -L ${GCC_MSP_INC} -I ${GCC_MSP_INC} -I ${GCC_ELF_INC}"
|
||||||
|
|
||||||
|
CFLAGS="-Os -D__${DEVICE}__ -mmcu=${DEVICE} -g -ffunction-sections -fdata-sections -DDEPRECATED"
|
||||||
|
LDFLAGS="-T ${GCC_LD} -L ${GCC_MSP_INC} -mmcu=${DEVICE} -g -Wl,--gc-sections"
|
||||||
|
INCLUDES="-I ${GCC_MSP_INC} -I ${GCC_ELF_INC}"
|
||||||
|
|
||||||
|
# files
|
||||||
|
EXOBJECT=$OUT_DIR/$DEVICE.elf.o
|
||||||
|
EXOUTPUT=$OUT_DIR/$DEVICE.elf.out
|
||||||
|
|
||||||
|
|
||||||
|
function execute(){
|
||||||
|
echo
|
||||||
|
echo ==========================
|
||||||
|
echo execute\> $*
|
||||||
|
$*
|
||||||
|
}
|
||||||
|
|
||||||
|
execute mkdir -p $OUT_DIR
|
||||||
|
execute $CC $MYFLAGS $MAIN_FILE -o $EXOUTPUT
|
||||||
|
# execute $CC $INCLUDES $CFLAGS -c $MAIN_FILE -o $EXOBJECT
|
||||||
|
# execute $CC $LDFLAGS $EXOBJECT -o $EXOUTPUT
|
||||||
|
|
||||||
|
# execute mspdebug rf2500 "prog ${EXOUTPUT}"
|
||||||
|
# execute mspdebug rf2500 "run"
|
||||||
7
decoders/README.md
Normal file
7
decoders/README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# decoders
|
||||||
|
|
||||||
|
This folder containts the decoders for Sigrok Pulseview to decode the data send and received by the muc
|
||||||
|
|
||||||
|
## what to find hire
|
||||||
|
|
||||||
|
- TMC429 decoder
|
||||||
9
decoders/tmc429/__init__.py
Normal file
9
decoders/tmc429/__init__.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
'''
|
||||||
|
This decoder stacks on top of the 'spi' PD and decodes the protocol spoken
|
||||||
|
by the Trinamic TMC429 motion controller chip.
|
||||||
|
|
||||||
|
Details:
|
||||||
|
https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC429_datasheet.pdf
|
||||||
|
'''
|
||||||
|
|
||||||
|
from .pd import Decoder
|
||||||
73
decoders/tmc429/pd.py
Normal file
73
decoders/tmc429/pd.py
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
import sigrokdecode as srd
|
||||||
|
from .lists import *
|
||||||
|
|
||||||
|
(
|
||||||
|
ANN_RS1, ANN_RS2, ANN_RS3, ANN_xEQ1, ANN_xEQ2, ANN_xEQ3,
|
||||||
|
ANN_WARN
|
||||||
|
) = range(7)
|
||||||
|
|
||||||
|
class Decoder(srd.Decoder):
|
||||||
|
api_version = 3
|
||||||
|
id = 'tmc429'
|
||||||
|
name = 'TMC429'
|
||||||
|
longname = 'Trinamic TMC429'
|
||||||
|
desc = 'Trinamic TMC429 3-axis motion controller.'
|
||||||
|
license = 'gplv3+'
|
||||||
|
inputs = ['spi']
|
||||||
|
outputs = []
|
||||||
|
tags = ['IC']
|
||||||
|
annotations = (
|
||||||
|
('RS1', 'Left rerence switch 1'),
|
||||||
|
('RS2', 'Left rerence switch 2'),
|
||||||
|
('RS3', 'Left rerence switch 3'),
|
||||||
|
('xEQ1', 'Motro 1 reached target posistion'),
|
||||||
|
('xEQ2', 'Motro 2 reached target posistion'),
|
||||||
|
('xEQ3', 'Motro 3 reached target posistion'),
|
||||||
|
('warning', 'Warnings')
|
||||||
|
)
|
||||||
|
annotation_rows = (
|
||||||
|
('recieve', 'Recieve', (ANN_RS1, ANN_RS2, ANN_RS3, ANN_xEQ1, ANN_xEQ2, ANN_xEQ3)),
|
||||||
|
('warning', 'Warnings', (ANN_WARN))
|
||||||
|
)
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.reset()
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
#self.ss_cmd, self.es_cmd = 0, 0
|
||||||
|
self.mosi_bytes = []
|
||||||
|
|
||||||
|
def start(self):
|
||||||
|
self.out_ann = self.register(srd.OUTPUT_ANN)
|
||||||
|
|
||||||
|
# def putx(self, data):
|
||||||
|
# self.put(self.ss_cmd, self.es_cmd, self.out_ann, data)
|
||||||
|
|
||||||
|
def put_warn(self, pos, msg):
|
||||||
|
self.put(pos[0], pos[1], self.out_ann, [2, [msg]])
|
||||||
|
|
||||||
|
def decode(self, ss, es, data):
|
||||||
|
if(data[0] == 'BITS'):
|
||||||
|
# check length of datapacket
|
||||||
|
if(len(data[1]) < 16):
|
||||||
|
# datapacket to short
|
||||||
|
#TODO: add error
|
||||||
|
return
|
||||||
|
|
||||||
|
# trim to the last 16 bits
|
||||||
|
#TODO: add warning it packet is to long
|
||||||
|
while(len(data[1]) == 16):
|
||||||
|
data[1].pop(0)
|
||||||
|
data[2].pop(0)
|
||||||
|
|
||||||
|
self.decodeRecieve(data[2])
|
||||||
|
|
||||||
|
def decodeRecieve(self, data):
|
||||||
|
# read left rerence switches
|
||||||
|
if(data[2][0]):
|
||||||
|
self.put(data[2][1], data[2][2], self.out_ann, [ANN_RS3, ['RS3']])
|
||||||
|
if(data[4][0]):
|
||||||
|
self.put(data[4][1], data[4][2], self.out_ann, [ANN_RS2, ['RS2']])
|
||||||
|
if(data[6][0]):
|
||||||
|
self.put(data[6][1], data[6][2], self.out_ann, [ANN_RS1, ['RS1']])
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user