Skip to content

Commit

Permalink
mecrisp-stellaris-ra-1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean Jonethal committed Oct 26, 2015
1 parent 1bd02d9 commit 09ea023
Show file tree
Hide file tree
Showing 35 changed files with 4,643 additions and 2,506 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,12 @@
- Contribution by Ulrich Hoffman:
Examples for syscall usage in ARM Linux

11.10.2015, Matthias Koch, Mecrisp-Stellaris 2.2.0 & RA 0.6 experimental
15.10.2015, Matthias Koch, Mecrisp-Stellaris 2.1.5

- Contribution by Абдрахимов Илья:
New target: STM L152 Discovery

22.10.2015, Matthias Koch, Mecrisp-Stellaris 2.2.0 & RA 1.0 experimental

- Merged the experimental RA branch with the mainstream package

Expand Down
2 changes: 2 additions & 0 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Examples for LPC1114FN28 by Bert Lohmann
Nucleo STM32F411 port by Jean Jonethal
An example for a custom prompt by Glen Worstell
Syscall usage examples by Ulrich Hoffmann
Discovery L152 port by Абдрахимов Илья

Hardware donations:

Expand All @@ -27,6 +28,7 @@ Carsten Strotmann
Testing and hints in alphabetical order:

John O. 'Sandy' Bumgarner
Ulrich Hoffmann
Jean Jonethal
Michael Kalus
Izidor Makuc
Expand Down
1 change: 1 addition & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Contributions:
- Teensy 3.1 with MK20DX256VLH7
- Chinese QF-LM4F232 with LM4F232H5QC
- nRFgo Starter Kit with nRF51822
- STM L152 Discovery with STM32L152RBT6

http://mecrisp.sourceforge.net/

Expand Down
22 changes: 7 additions & 15 deletions common/sine.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,21 @@ decimal

: 2rshift 0 ?do d2/ loop ;

: cordic-erster-teil
: cordic ( f-angle -- f-error f-sine f-cosine )
( Angle between -Pi/2 and +Pi/2 ! )
0 0 $9B74EDA8 0
32 0 do
2rot dup 0<
if
i e^ka 0 d+ 2rot 2rot
2over i 2rshift 2rot 2rot
2swap 2over i 2rshift
d- 2rot 2rot d+
;

: cordic-zweiter-teil
else
i e^ka 0 d- 2rot 2rot
2over i 2rshift 2rot 2rot
2swap 2over i 2rshift
d+ 2rot 2rot 2swap d-
;

: cordic ( f-angle -- f-error f-sine f-cosine )
( Angle between -Pi/2 and +Pi/2 ! )
0 0 $9B74EDA8 0
32 0 do
2rot dup 0<
if
cordic-erster-teil
else
cordic-zweiter-teil
then
loop
2-foldable ;
Expand Down
1 change: 1 addition & 0 deletions kl25z128-ra/buildfresh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ cd ../mecrisp-stellaris-source
./assemble
cd ../kl25z128-ra

ls -l *.bin
./thumbulator *.bin
Binary file modified kl25z128-ra/mecrisp-stellaris-kl25z128.bin
Binary file not shown.
109 changes: 109 additions & 0 deletions kl25z128-ra/sine.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@

compiletoflash

here

\ Sine and Cosine with Cordic algorithm

: numbertable <builds does> swap 2 lshift + @ ;

hex
numbertable e^ka

C90FDAA2 ,
76B19C15 ,
3EB6EBF2 ,
1FD5BA9A ,
0FFAADDB ,
07FF556E ,
03FFEAAB ,
01FFFD55 ,

00FFFFAA ,
007FFFF5 ,
003FFFFE ,
001FFFFF ,
000FFFFF ,
0007FFFF ,
0003FFFF ,
0001FFFF ,

0000FFFF ,
00007FFF ,
00003FFF ,
00001FFF ,
00000FFF ,
000007FF ,
000003FF ,
000001FF ,

000000FF ,
0000007F ,
0000003F ,
0000001F ,
0000000F ,
00000007 ,
00000003 ,
00000001 ,

decimal

: 2rshift 0 ?do d2/ loop ;

: cordic ( f-angle -- f-error f-sine f-cosine )
( Angle between -Pi/2 and +Pi/2 ! )
0 0 $9B74EDA8 0
32 0 do
2rot dup 0<
if
i e^ka 0 d+ 2rot 2rot
2over i 2rshift 2rot 2rot
2swap 2over i 2rshift
d- 2rot 2rot d+
else
i e^ka 0 d- 2rot 2rot
2over i 2rshift 2rot 2rot
2swap 2over i 2rshift
d+ 2rot 2rot 2swap d-
then
loop
2-foldable ;

: sine ( f-angle -- f-sine ) cordic 2drop 2nip 2-foldable ;
: cosine ( f-angle -- f-cosine ) cordic 2nip 2nip 2-foldable ;

3,141592653589793 2constant pi
pi 2,0 f/ 2constant pi/2
pi 4,0 f/ cosine f. \ Displays cos(Pi/4)

: widecosine ( f-angle -- f-cosine )
dabs
pi/2 ud/mod drop 3 and ( Quadrant f-angle )

case
0 of cosine endof
1 of dnegate pi/2 d+ cosine dnegate endof
2 of cosine dnegate endof
3 of dnegate pi/2 d+ cosine endof
endcase

2-foldable ;

: widesine ( f-angle -- f-sine )
dup >r \ Save sign
dabs
pi/2 ud/mod drop 3 and ( Quadrant f-angle )

case
0 of sine endof
1 of dnegate pi/2 d+ sine endof
2 of sine dnegate endof
3 of dnegate pi/2 d+ sine dnegate endof
endcase

r> 0< if dnegate then
2-foldable ;


here swap -
. \ Mecrisp-Stellaris 2.2.0: 1120 Bytes
Loading

0 comments on commit 09ea023

Please sign in to comment.