Skip to content

Commit

Permalink
Adding first FFI prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansuchocki committed Dec 2, 2014
1 parent 72bff22 commit d1ae947
Show file tree
Hide file tree
Showing 10 changed files with 695 additions and 2 deletions.
5 changes: 5 additions & 0 deletions emulator.scm
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
;; Microscheme primitives for other scheme implementations...
;; microscheme.org

;; This file defines microscheme-specific syntax/primitives,
;; and emulates a set of digital I/O registers, so that you
;; can run Microscheme programs on other Scheme implementations
;; (For example, on your PC).

(define-syntax free!
(syntax-rules ()
((free! body ...)
Expand Down
22 changes: 22 additions & 0 deletions ffi_stuff/dump.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

import serial
import time


ser = serial.Serial("/dev/ttyACM0", 9600)
ser.flushInput()
ser.close()

ser.open()

b1 = 0
b2 = 0
val = 0



while 1:
b1 = ser.read();
b2 = ser.read();
val = (ord(b1) << 8) + ord(b2)
print (str(val))
Binary file added ffi_stuff/ffi-test.elf
Binary file not shown.
52 changes: 52 additions & 0 deletions ffi_stuff/ffi-test.hex
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
:100000000C942A000C9434000C9434000C943400AA
:100010000C9434000C9434000C9434000C94340090
:100020000C9434000C9434000C9434000C94340080
:100030000C9434000C9434000C9434000C94340070
:100040000C9434000C9434000C9434000C94340060
:100050000C94340011241FBECFE5D4E0DEBFCDBF29
:100060000E9436000C9496010C9400000EEF402E76
:100070005524C0E0D0E0A0E0B1E080E090E0EFEFF8
:10008000F8E0EDBFFEBF259A2D9800E00093C50073
:1000900007E60093C4000027086000610093C100D8
:1000A000E9C00D2F007E10EC01137DC0DF71CE0181
:1000B000088107137DC0F981EA8109940D931D938E
:1000C000CD93DD93ED012497D06808950D2F007E28
:1000D00010E801137AC0DF710881D981C02F08951B
:1000E0000D2F007E10E8011370C0DF710A81DB81E3
:1000F000C02F08952D2F207E30E8231366C0DF71B6
:100100000883198308952D2F207E30E823135DC0C6
:10011000DF710A831B8308952D2F207E30EA23137D
:100120005CC0DF71299139910217130708F05EC096
:10013000000F111FC00FD11F0881D981C02F089552
:100140004D2F407E50EA451348C0DF7149915991C7
:100150000417150708F04AC0000F111FC00FD11F68
:100160002883398308952D2F207E30EA231335C04C
:10017000DF710881D981C02F0895C017D10718F009
:10018000DEEFCC270895DFEFCC2708959E01CC2722
:10019000DD272515350509F433C0021B130B10F0BC
:1001A0002196FBCF08955DD0D3E0C8EE45D0FBCFBC
:1001B00058D057D0D3E0A8EE3FD0FACF52D051D08C
:1001C00050D0D3E0A8EE38D0F9CF4BD04AD049D0A8
:1001D00048D0D3E0A8EE30D0F8CF43D042D041D0C1
:1001E00040D03FD0D3E0A8EE27D0F7CF3AD039D0D7
:1001F00038D037D036D035D0D3E0A8EE1DD0F6CFEA
:1002000030D02FD02ED02DD02CD02BD02AD0D3E050
:10021000A8EE12D0F5CF25D0FECF0F930091C000ED
:1002200005FFFCCFD093C6000091C00005FFFCCFB6
:10023000C093C6000F9108959F938F939FE080EA2B
:100240000197F1F72197D1F78F919F9108955F92D0
:100250005F905F925F905F925F9000002197B9F787
:1002600008952D9AD0E0C8ECE7DF2D98D0E0C8ECD7
:10027000E3DF08958F939F93AF93BF93EF93FF9323
:100280001F921124D0E0C5E08C2F9D2FD0E0C2E05A
:100290006C2F7D2FD0E0C7E04C2F5D2F0CD0EC01F0
:1002A0001F90FF91EF91BF91AF919F918F910E940D
:1002B0000D010C949501CF93DF9300D000D000D0B6
:1002C000CDB7DEB79A8389837C836B835E834D834E
:1002D00029813A818B819C81820F931F8230910505
:1002E00018F480E090E018C029813A818B819C81CC
:1002F000820F931F8430910518F481E090E00CC0C8
:1003000029813A818B819C81820F931F86309105D0
:1003100018F48D819E8100C026960FB6F894DEBF3A
:100320000FBECDBFDF91CF9108952D9AF894FFCFE6
:00000001FF
6 changes: 6 additions & 0 deletions ffi_stuff/ffi-test.ms
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(serial-send
(call-c-func "myfunc" 5 2 7))

(asm "JMP .end")
(include-asm "working/ffitest.s")
(asm ".end:")
Loading

0 comments on commit d1ae947

Please sign in to comment.