Compare commits
49 Commits
Author | SHA1 | Date |
---|---|---|
Clyne | 6264c07c3b | 7 months ago |
Clyne | 9ac70bfc0e | 10 months ago |
Clyne | ebbde43fa9 | 10 months ago |
Clyne | 23d746d646 | 10 months ago |
Clyne | af51fb5bdf | 10 months ago |
Clyne | 5162349f92 | 10 months ago |
Clyne | f21da699e5 | 10 months ago |
Clyne | cdf19490df | 10 months ago |
Clyne | 69152efdad | 10 months ago |
Clyne | f8f73362a8 | 10 months ago |
Clyne | fbaf08aa6c | 10 months ago |
Clyne | 957cf676ff | 10 months ago |
Clyne | 494bd41b64 | 10 months ago |
Clyne | 0810456e9c | 11 months ago |
Clyne | 513136558e | 11 months ago |
Clyne | 4bf01807b2 | 11 months ago |
Clyne | 2b64fbdfb8 | 11 months ago |
Clyne | 6496152f57 | 11 months ago |
Clyne | d6ee894c13 | 11 months ago |
Clyne | 8e7cb05cfb | 11 months ago |
Clyne | a7b3cc1604 | 11 months ago |
Clyne | 7e10d0855c | 11 months ago |
Clyne | 789791692a | 11 months ago |
Clyne | 8f30a73807 | 11 months ago |
Clyne | e175ab21b3 | 11 months ago |
Clyne | 974f49ca16 | 11 months ago |
Clyne | 9bb53dc9d7 | 11 months ago |
Clyne | 4a1ec24592 | 11 months ago |
Clyne | ea026f8d67 | 11 months ago |
Clyne | b26edffda0 | 11 months ago |
Clyne | 6dcf780a3b | 11 months ago |
Clyne | 6bd7338414 | 11 months ago |
Clyne | 97a590fc8e | 11 months ago |
Clyne | 91566e20e8 | 11 months ago |
Clyne | 3bb6ecbb23 | 11 months ago |
Clyne | ddba135e7d | 11 months ago |
Clyne | 79a15b78b1 | 11 months ago |
Clyne | 5ee8f7e01d | 11 months ago |
Clyne | 6b1955a69e | 11 months ago |
Clyne | 650a344aad | 11 months ago |
Clyne | 7381e87be6 | 11 months ago |
Clyne | 194acf022d | 11 months ago |
Clyne | 6bd7c01389 | 11 months ago |
Clyne | 3d7a45e5cd | 11 months ago |
Clyne | 5991370657 | 11 months ago |
Clyne | 70e399b498 | 11 months ago |
Clyne | 0b2ef84376 | 11 months ago |
Clyne | f7a9103bbe | 11 months ago |
Clyne | 15c0c2f789 | 11 months ago |
@ -0,0 +1 @@
|
||||
msp430/msp430fr2476.h linguist-vendored
|
@ -1,8 +1,13 @@
|
||||
.*
|
||||
*.o
|
||||
*.dat
|
||||
*.bin
|
||||
*.lzss
|
||||
alee
|
||||
alee-msp430
|
||||
alee-standalone
|
||||
libalee.a
|
||||
core.fth.h
|
||||
doc/
|
||||
msp430/lzss
|
||||
msp430/msp430fr2476_all.h
|
||||
|
@ -0,0 +1,3 @@
|
||||
[submodule "tests"]
|
||||
path = tests
|
||||
url = https://github.com/gerryjackson/forth2012-test-suite
|
@ -1,41 +1,33 @@
|
||||
# Alee Forth
|
||||
|
||||
Alee is a concise Forth implementation written in modern C++ that aims for portability, minimal program size, and execution efficiency.
|
||||
Alee Forth is a concise Forth implementation written in modern C++ that aims for portability, minimal memory footprint, and execution efficiency.
|
||||
|
||||
## Cross-platform compatibility
|
||||
|
||||
Alee relies on the C++17 standard. Alee *does not* rely on operating-system-specific functions, making portability easy.
|
||||
Alee Forth relies on the C++20 standard. It *does not* rely on any operating system. As a result, portability extends down to microcontroller targets with < 16kB flash and < 1 kB of RAM. See the `msp430` folder for an example of such a port.
|
||||
|
||||
The goal of portability extends down to microcontroller targets with kilobytes of memory. See the `msp430` target for an example of a port.
|
||||
|
||||
System-specific functionality is obtained through a `sys` Forth word. This word calls a user-supplied C++ function that implements the necessary (or any additional) functionality.
|
||||
System-specific functionality is achieved through a `sys` Forth word. This word calls a user-supplied C++ function that implements whatever functionality is needed.
|
||||
|
||||
## Forth compatibility
|
||||
|
||||
Alee implements a large majority of the "core" and "core extension" [word sets](https://forth-standard.org/standard/core). Implementation is tracked in `compat.txt`, with missing words listed below. Fundamental words are built into Alee (written in C++); the rest of the implementation is in `core.fth` and `core-ext.fth`.
|
||||
|
||||
Running Alee without `core.fth` or `core-ext.fth` passed as arguments will leave you with a minimal word set. The `standalone` target will package the `core.fth` dictionary into the program.
|
||||
Alee Forth uses the [Forth 2012 test suite](https://github.com/gerryjackson/forth2012-test-suite) to ensure standards compliance. The entire "core" [word-set](https://forth-standard.org/standard/core) is implemented as well as most of the "core extension" word-set. The compiled program contains a minimal set of fundamental words with libraries in the `forth` directory supplying these larger word-sets. The "core" word-set can be compiled into the program by building the `standalone` target.
|
||||
|
||||
**Missing** core features:
|
||||
* Pictured numeric output conversion (e.g. `<# #>`)
|
||||
**Missing** core extension words:
|
||||
|
||||
**Missing** core extensions:
|
||||
```
|
||||
.R HOLDS PAD PARSE PARSE-NAME REFILL RESTORE-INPUT S\" SAVE-INPUT SOURCE-ID U.R U> UNUSED WITHIN [COMPILE]
|
||||
PARSE-NAME REFILL RESTORE-INPUT S\" SAVE-INPUT
|
||||
```
|
||||
|
||||
Alee aims for compliance with common Forth standards like Forth 2012 and ANS Forth. Compliance is tested using a [Forth 2012 test suite](https://github.com/gerryjackson/forth2012-test-suite). Supported test files are in the `test` directory, with tests for unimplemented words commented out.
|
||||
|
||||
## Building
|
||||
|
||||
Alee requires `make` and a C++17-compatible compiler. Simply running `make` will produce the `libalee.a` library and a REPL binary named `alee`. Note that this binary has no built-in libraries; these can be passed in by calling `./alee core.fth core-ext.fth`.
|
||||
Alee requires `make` and a compiler that supports C++20. Simply running `make` will produce the `libalee.a` library and a REPL binary named `alee`. The core word-sets can be passed into `alee` via the command line: `./alee forth/core.fth forth/core-ext.fth`.
|
||||
|
||||
There are other build targets:
|
||||
Other available build targets:
|
||||
|
||||
* `small`: Optimize for minimal binary size.
|
||||
* `fast`: Optimize for maximum performance on the host system.
|
||||
* `standalone`: Builds the core dictionary (`core.fth`) into the binary.
|
||||
* `msp430`: Builds a binary for the [MSP430G2553](https://www.ti.com/product/MSP430G2553) microcontroller. The `standalone` target must be built first for the core dictionary.
|
||||
* `msp430-prep` and `msp430`: Builds a binary for the [MSP430G2553](https://www.ti.com/product/MSP430G2553) microcontroller. See the `msp430` folder for more information.
|
||||
|
||||
If building for a new platform, see `Makefile`, `types.hpp`, and `state.hpp` for available configuration options.
|
||||
If building for a new platform, review these files: `Makefile`, `libalee/types.hpp`, and `libalee/state.hpp`. It is possible to modify the implementation to use 32-bit words, but this will require re-writing the core word-sets.
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
#include "libalee/parser.hpp"
|
||||
#include "libalee/state.hpp"
|
||||
|
@ -1,187 +0,0 @@
|
||||
6.1 Core words
|
||||
|
||||
yes 6.1.0010 !
|
||||
6.1.0030 #
|
||||
6.1.0040 #>
|
||||
6.1.0050 #S
|
||||
yes 6.1.0070 '
|
||||
yes 6.1.0080 (
|
||||
yes 6.1.0090 *
|
||||
yes 6.1.0100 */
|
||||
yes 6.1.0110 */MOD
|
||||
yes 6.1.0120
|
||||
yes 6.1.0130 +!
|
||||
yes 6.1.0140 +LOOP
|
||||
yes 6.1.0150 ,
|
||||
yes 6.1.0160 -
|
||||
yes 6.1.0180 .
|
||||
yes 6.1.0190 ."
|
||||
yes 6.1.0230 /
|
||||
yes 6.1.0240 /MOD
|
||||
yes 6.1.0250 0<
|
||||
yes 6.1.0270 0=
|
||||
yes 6.1.0290 1+
|
||||
yes 6.1.0300 1-
|
||||
yes 6.1.0310 2!
|
||||
yes 6.1.0320 2*
|
||||
yes 6.1.0330 2/
|
||||
yes 6.1.0350 2@
|
||||
yes 6.1.0370 2DROP
|
||||
yes 6.1.0380 2DUP
|
||||
yes 6.1.0400 2OVER
|
||||
yes 6.1.0430 2SWAP
|
||||
yes 6.1.0450 :
|
||||
yes 6.1.0460 ;
|
||||
yes 6.1.0480 <
|
||||
6.1.0490 <#
|
||||
yes 6.1.0530 =
|
||||
yes 6.1.0540 >
|
||||
yes 6.1.0550 >BODY
|
||||
yes 6.1.0560 >IN
|
||||
yes 6.1.0570 >NUMBER
|
||||
yes 6.1.0580 >R
|
||||
yes 6.1.0630 ?DUP
|
||||
yes 6.1.0650 @
|
||||
yes 6.1.0670 ABORT
|
||||
yes 6.1.0680 ABORT"
|
||||
yes 6.1.0690 ABS
|
||||
yes 6.1.0695 ACCEPT
|
||||
yes 6.1.0705 ALIGN
|
||||
yes 6.1.0706 ALIGNED
|
||||
yes 6.1.0710 ALLOT
|
||||
yes 6.1.0720 AND
|
||||
yes 6.1.0750 BASE
|
||||
yes 6.1.0760 BEGIN
|
||||
yes 6.1.0770 BL
|
||||
yes 6.1.0850 C!
|
||||
yes 6.1.0860 C,
|
||||
yes 6.1.0870 C@
|
||||
yes 6.1.0880 CELL+
|
||||
yes 6.1.0890 CELLS
|
||||
yes 6.1.0895 CHAR
|
||||
yes 6.1.0897 CHAR+
|
||||
yes 6.1.0898 CHARS
|
||||
yes 6.1.0950 CONSTANT
|
||||
yes 6.1.0980 COUNT
|
||||
yes 6.1.0990 CR
|
||||
yes 6.1.1000 CREATE
|
||||
yes 6.1.1170 DECIMAL
|
||||
yes 6.1.1200 DEPTH
|
||||
yes 6.1.1240 DO
|
||||
yes 6.1.1250 DOES>
|
||||
yes 6.1.1260 DROP
|
||||
yes 6.1.1290 DUP
|
||||
yes 6.1.1310 ELSE
|
||||
yes 6.1.1320 EMIT
|
||||
yes 6.1.1345 ENVIRONMENT? (always false)
|
||||
yes 6.1.1360 EVALUATE
|
||||
yes 6.1.1370 EXECUTE
|
||||
yes 6.1.1380 EXIT
|
||||
yes 6.1.1540 FILL
|
||||
yes 6.1.1550 FIND
|
||||
yes 6.1.1561 FM/MOD
|
||||
yes 6.1.1650 HERE
|
||||
6.1.1670 HOLD
|
||||
yes 6.1.1680 I
|
||||
yes 6.1.1700 IF
|
||||
yes 6.1.1710 IMMEDIATE (as "imm")
|
||||
yes 6.1.1720 INVERT
|
||||
yes 6.1.1730 J
|
||||
yes 6.1.1750 KEY
|
||||
yes 6.1.1760 LEAVE
|
||||
yes 6.1.1780 LITERAL
|
||||
yes 6.1.1800 LOOP
|
||||
yes 6.1.1805 LSHIFT
|
||||
yes 6.1.1810 M*
|
||||
yes 6.1.1870 MAX
|
||||
yes 6.1.1880 MIN
|
||||
yes 6.1.1890 MOD
|
||||
yes 6.1.1900 MOVE
|
||||
yes 6.1.1910 NEGATE
|
||||
yes 6.1.1980 OR
|
||||
yes 6.1.1990 OVER
|
||||
yes 6.1.2033 POSTPONE
|
||||
yes 6.1.2050 QUIT
|
||||
yes 6.1.2060 R>
|
||||
yes 6.1.2070 R@
|
||||
yes 6.1.2120 RECURSE
|
||||
yes 6.1.2140 REPEAT
|
||||
yes 6.1.2160 ROT
|
||||
yes 6.1.2162 RSHIFT
|
||||
yes 6.1.2165 S"
|
||||
yes 6.1.2170 S>D
|
||||
6.1.2210 SIGN
|
||||
yes 6.1.2214 SM/REM
|
||||
yes 6.1.2216 SOURCE
|
||||
yes 6.1.2220 SPACE
|
||||
yes 6.1.2230 SPACES
|
||||
yes 6.1.2250 STATE
|
||||
yes 6.1.2260 SWAP
|
||||
yes 6.1.2270 THEN
|
||||
yes 6.1.2310 TYPE
|
||||
yes 6.1.2320 U.
|
||||
yes 6.1.2340 U<
|
||||
yes 6.1.2360 UM*
|
||||
yes 6.1.2370 UM/MOD
|
||||
yes 6.1.2380 UNLOOP
|
||||
yes 6.1.2390 UNTIL
|
||||
yes 6.1.2410 VARIABLE
|
||||
yes 6.1.2430 WHILE
|
||||
yes 6.1.2450 WORD
|
||||
yes 6.1.2490 XOR
|
||||
yes 6.1.2500 [
|
||||
yes 6.1.2510 [']
|
||||
yes 6.1.2520 [CHAR]
|
||||
yes 6.1.2540 ]
|
||||
|
||||
6.2 Core extension words
|
||||
|
||||
yes 6.2.0200 .(
|
||||
6.2.0210 .R
|
||||
yes 6.2.0260 0<>
|
||||
yes 6.2.0280 0>
|
||||
yes 6.2.0340 2>R
|
||||
yes 6.2.0410 2R>
|
||||
yes 6.2.0415 2R@
|
||||
yes 6.2.0455 :NONAME
|
||||
yes 6.2.0500 <>
|
||||
yes 6.2.0620 ?DO
|
||||
yes 6.2.0698 ACTION-OF
|
||||
yes 6.2.0700 AGAIN
|
||||
yes 6.2.0825 BUFFER:
|
||||
yes 6.2.0855 C"
|
||||
yes 6.2.0873 CASE
|
||||
yes 6.2.0945 COMPILE,
|
||||
yes 6.2.1173 DEFER
|
||||
yes 6.2.1175 DEFER!
|
||||
yes 6.2.1177 DEFER@
|
||||
yes 6.2.1342 ENDCASE
|
||||
yes 6.2.1343 ENDOF
|
||||
yes 6.2.1350 ERASE
|
||||
yes 6.2.1485 FALSE
|
||||
yes 6.2.1660 HEX
|
||||
6.2.1675 HOLDS
|
||||
yes 6.2.1725 IS
|
||||
yes 6.2.1850 MARKER
|
||||
yes 6.2.1930 NIP
|
||||
yes 6.2.1950 OF
|
||||
6.2.2000 PAD
|
||||
6.2.2008 PARSE
|
||||
6.2.2020 PARSE-NAME
|
||||
yes 6.2.2030 PICK
|
||||
6.2.2125 REFILL
|
||||
6.2.2148 RESTORE-INPUT
|
||||
yes 6.2.2150 ROLL
|
||||
6.2.2266 S\"
|
||||
6.2.2182 SAVE-INPUT
|
||||
6.2.2218 SOURCE-ID
|
||||
yes 6.2.2295 TO
|
||||
yes 6.2.2298 TRUE
|
||||
yes 6.2.2300 TUCK
|
||||
6.2.2330 U.R
|
||||
6.2.2350 U>
|
||||
6.2.2395 UNUSED
|
||||
yes 6.2.2405 VALUE
|
||||
6.2.2440 WITHIN
|
||||
6.2.2530 [COMPILE]
|
||||
yes 6.2.2535 \
|
@ -0,0 +1,97 @@
|
||||
: vector! 10 sys ;
|
||||
: byte! 11 sys ;
|
||||
: byte@ 12 sys ;
|
||||
: reg! 13 sys ;
|
||||
: reg@ 14 sys ;
|
||||
: sr+ 15 sys ;
|
||||
: sr- 16 sys ;
|
||||
: lpm-exit 17 sys ;
|
||||
|
||||
: reg [ ' reg@ ' reg! ] literal literal ;
|
||||
: byte [ ' byte@ ' byte! ] literal literal ;
|
||||
|
||||
: set ( b r reg/byte -- )
|
||||
>r over r> execute >r rot r> | -rot execute ;
|
||||
: clear ( b r reg/byte -- )
|
||||
>r over r> execute >r rot invert r> & -rot execute ;
|
||||
: toggle ( b r reg/byte -- )
|
||||
>r over r> execute >r rot r> ^ -rot execute ;
|
||||
|
||||
create _outs p1out , p2out , p3out , p4out , p5out , p6out ,
|
||||
create _ins p1in , p2in , p3in , p4in , p5in , p6in ,
|
||||
create _dirs p1dir , p2dir , p3dir , p4dir , p5dir , p6dir ,
|
||||
|
||||
1 constant output
|
||||
0 constant input
|
||||
|
||||
: pin-mode ( output? pin port -- )
|
||||
rot >r cells _dirs + @ byte r> if set else clear then ;
|
||||
|
||||
: pin-set ( high? pin port -- )
|
||||
rot >r cells _outs + @ byte r> if set else clear then ;
|
||||
|
||||
: pin-get ( pin port -- high? )
|
||||
cells _ins + @ byte@ swap and 0 > ;
|
||||
|
||||
: analog-init
|
||||
adcon adcsht_2 or adcctl0 reg set
|
||||
adcshp adcctl1 reg set
|
||||
adcres adcctl2 reg clear
|
||||
adcres_2 adcctl2 reg set
|
||||
adcie0 adcie reg set ;
|
||||
|
||||
: rtc-init
|
||||
rtcps__10 rtcctl reg! ;
|
||||
|
||||
: ms ( u -- )
|
||||
rtcmod reg!
|
||||
rtcss_3 rtcsr or rtcctl reg set
|
||||
begin rtciv reg@ 0<> until
|
||||
rtc-init ;
|
||||
|
||||
: D0 bit5 1 ;
|
||||
: D1 bit6 1 ;
|
||||
: D2 bit1 2 ;
|
||||
: D3 bit4 1 ;
|
||||
: D4 bit7 2 ;
|
||||
: D5 bit0 3 ;
|
||||
: D6 bit1 3 ;
|
||||
: D7 bit7 3 ;
|
||||
: D8 bit6 3 ;
|
||||
: D9 bit5 3 ;
|
||||
: D10 bit4 4 ;
|
||||
: D11 bit2 2 ;
|
||||
: D12 bit6 2 ;
|
||||
: D13 bit5 2 ;
|
||||
|
||||
: A0 bit0 0 ;
|
||||
: A1 bit1 0 ;
|
||||
: A2 bit5 0 ;
|
||||
: A3 bit6 0 ;
|
||||
: A4 bit2 0 ;
|
||||
: A5 bit3 0 ;
|
||||
: AREF bit4 0 ;
|
||||
|
||||
: pin-analog
|
||||
drop
|
||||
dup p1sel0 reg set
|
||||
p1sel1 reg set ;
|
||||
|
||||
: analog-get
|
||||
drop 0 begin
|
||||
swap 2/ dup 0<> while
|
||||
swap 1+ repeat
|
||||
drop adcmctl0 reg!
|
||||
adcenc adcsc or adcctl0 reg set
|
||||
adcmem0 reg@ ;
|
||||
|
||||
: LED1R bit1 5 ;
|
||||
: LED1G bit0 5 ;
|
||||
: LED1B bit2 5 ;
|
||||
|
||||
: LED2R bit6 4 ;
|
||||
: LED2G bit5 4 ;
|
||||
: LED2B bit7 4 ;
|
||||
|
||||
: SW2 bit3 1 ;
|
||||
: SW3 bit4 2 ;
|
File diff suppressed because it is too large
Load Diff
@ -1,66 +0,0 @@
|
||||
\ From: John Hayes S1I
|
||||
\ Subject: tester.fr
|
||||
\ Date: Mon, 27 Nov 95 13:10:09 PST
|
||||
|
||||
\ (C) 1995 JOHNS HOPKINS UNIVERSITY / APPLIED PHYSICS LABORATORY
|
||||
\ MAY BE DISTRIBUTED FREELY AS LONG AS THIS COPYRIGHT NOTICE REMAINS.
|
||||
\ VERSION 1.2
|
||||
|
||||
\ 24/11/2015 Replaced Core Ext word <> with = 0=
|
||||
\ 31/3/2015 Variable #ERRORS added and incremented for each error reported.
|
||||
\ 22/1/09 The words { and } have been changed to T{ and }T respectively to
|
||||
\ agree with the Forth 200X file ttester.fs. This avoids clashes with
|
||||
\ locals using { ... } and the FSL use of }
|
||||
|
||||
HEX
|
||||
|
||||
\ SET THE FOLLOWING FLAG TO TRUE FOR MORE VERBOSE OUTPUT; THIS MAY
|
||||
\ ALLOW YOU TO TELL WHICH TEST CAUSED YOUR SYSTEM TO HANG.
|
||||
VARIABLE VERBOSE
|
||||
FALSE VERBOSE !
|
||||
\ TRUE VERBOSE !
|
||||
|
||||
: EMPTY-STACK \ ( ... -- ) EMPTY STACK: HANDLES UNDERFLOWED STACK TOO.
|
||||
DEPTH ?DUP IF DUP 0< IF NEGATE 0 DO 0 LOOP ELSE 0 DO DROP LOOP THEN THEN ;
|
||||
|
||||
VARIABLE #ERRORS 0 #ERRORS !
|
||||
|
||||
: ERROR \ ( C-ADDR U -- ) DISPLAY AN ERROR MESSAGE FOLLOWED BY
|
||||
\ THE LINE THAT HAD THE ERROR.
|
||||
CR TYPE SOURCE TYPE \ DISPLAY LINE CORRESPONDING TO ERROR
|
||||
EMPTY-STACK \ THROW AWAY EVERY THING ELSE
|
||||
#ERRORS @ 1 + #ERRORS !
|
||||
\ QUIT \ *** Uncomment this line to QUIT on an error
|
||||
;
|
||||
|
||||
VARIABLE ACTUAL-DEPTH \ STACK RECORD
|
||||
CREATE ACTUAL-RESULTS 20 CELLS ALLOT
|
||||
|
||||
: T{ \ ( -- ) SYNTACTIC SUGAR.
|
||||
;
|
||||
|
||||
: -> \ ( ... -- ) RECORD DEPTH AND CONTENT OF STACK.
|
||||
DEPTH DUP ACTUAL-DEPTH ! \ RECORD DEPTH
|
||||
?DUP IF \ IF THERE IS SOMETHING ON STACK
|
||||
0 DO ACTUAL-RESULTS I CELLS + ! LOOP \ SAVE THEM
|
||||
THEN ;
|
||||
|
||||
: }T \ ( ... -- ) COMPARE STACK (EXPECTED) CONTENTS WITH SAVED
|
||||
\ (ACTUAL) CONTENTS.
|
||||
DEPTH ACTUAL-DEPTH @ = IF \ IF DEPTHS MATCH
|
||||
DEPTH ?DUP IF \ IF THERE IS SOMETHING ON THE STACK
|
||||
0 DO \ FOR EACH STACK ITEM
|
||||
ACTUAL-RESULTS I CELLS + @ \ COMPARE ACTUAL WITH EXPECTED
|
||||
= 0= IF S" INCORRECT RESULT: " ERROR LEAVE THEN
|
||||
LOOP
|
||||
THEN
|
||||
ELSE \ DEPTH MISMATCH
|
||||
S" WRONG NUMBER OF RESULTS: " ERROR
|
||||
THEN ;
|
||||
|
||||
: TESTING \ ( -- ) TALKING COMMENT.
|
||||
SOURCE VERBOSE @
|
||||
IF DUP >R TYPE CR R> >IN !
|
||||
ELSE >IN ! DROP [CHAR] * EMIT
|
||||
THEN ;
|
||||
|
@ -0,0 +1,13 @@
|
||||
: .s depth dup 0 ?do dup i - pick . loop drop ;
|
||||
: ? @ . ;
|
||||
: dump hex 0 do i cells over + @ s>d <# # # # # bl hold #> type loop
|
||||
drop decimal ;
|
||||
|
||||
: words _latest @ begin
|
||||
dup @ dup 31 &
|
||||
2 pick cell+ \ lt l len ws
|
||||
2 pick 6 >> 1023 < if \ lt l len ws
|
||||
rot 6 >> else \ lt len ws adv
|
||||
>r cell+ rot drop r> @ then
|
||||
-rot swap type space \ lt adv
|
||||
over _begin <> while - repeat 2drop ;
|
@ -0,0 +1,7 @@
|
||||
#include "config.hpp"
|
||||
#include "corewords.hpp"
|
||||
#include "ctype.hpp"
|
||||
#include "dictionary.hpp"
|
||||
#include "parser.hpp"
|
||||
#include "state.hpp"
|
||||
#include "types.hpp"
|
@ -0,0 +1,5 @@
|
||||
#ifndef ALEE_MSP430_HOST
|
||||
#define LIBALEE_SECTION
|
||||
#else
|
||||
#define LIBALEE_SECTION __attribute__((section(".libalee")))
|
||||
#endif
|
@ -1,36 +0,0 @@
|
||||
/**
|
||||
* Alee Forth: A portable and concise Forth implementation in modern C++.
|
||||
* Copyright (C) 2023 Clyne Sullivan <clyne@bitgloo.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ctype.hpp"
|
||||
|
||||
bool isspace(uint8_t c) {
|
||||
return c == ' ' || c == '\t' || c == '\r' || c == '\n';
|
||||
}
|
||||
|
||||
bool isdigit(uint8_t c) {
|
||||
return c >= '0' && c <= '9';
|
||||
}
|
||||
|
||||
bool isalpha(uint8_t c) {
|
||||
return isupper(c) || (c >= 'a' && c <= 'z');
|
||||
}
|
||||
|
||||
bool isupper(uint8_t c) {
|
||||
return c >= 'A' && c <= 'Z';
|
||||
}
|
||||
|
@ -1,34 +1,59 @@
|
||||
/**
|
||||
* Alee Forth: A portable and concise Forth implementation in modern C++.
|
||||
* Copyright (C) 2023 Clyne Sullivan <clyne@bitgloo.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
//
|
||||
/// @file ctype.hpp
|
||||
/// @brief Simple implementations of character comparison functions.
|
||||
//
|
||||
// Alee Forth: A portable and concise Forth implementation in modern C++.
|
||||
// Copyright (C) 2023 Clyne Sullivan <clyne@bitgloo.com>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef ALEEFORTH_CTYPE_HPP
|
||||
#define ALEEFORTH_CTYPE_HPP
|
||||
|
||||
/**
|
||||
* We implement our own character comparison functions to keep them lean.
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
bool isspace(uint8_t);
|
||||
bool isdigit(uint8_t);
|
||||
bool isalpha(uint8_t);
|
||||
bool isupper(uint8_t);
|
||||
/** Determines the length of a null-terminated string. */
|
||||
constexpr inline unsigned strlen(const char * const s) {
|
||||
unsigned i = 0;
|
||||
while (s[i]) i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
/** Tests if given character represents whitespace. */
|
||||
constexpr inline bool isspace(uint8_t c) {
|
||||
return c == ' ' || c == '\t' || c == '\r' || c == '\n';
|
||||
}
|
||||
|
||||
/** Tests if given character is a numerical digit. */
|
||||
constexpr inline bool isdigit(uint8_t c) {
|
||||
return c >= '0' && c <= '9';
|
||||
}
|
||||
|
||||
/** Tests if given character is an uppercase letter. */
|
||||
constexpr inline bool isupper(uint8_t c) {
|
||||
return c >= 'A' && c <= 'Z';
|
||||
}
|
||||
|
||||
/** Tests if given character is a lowercase letter. */
|
||||
constexpr inline bool islower(uint8_t c) {
|
||||
return c >= 'a' && c <= 'z';
|
||||
}
|
||||
|
||||
/** Tests if given character is a letter. */
|
||||
constexpr inline bool isalpha(uint8_t c) {
|
||||
return isupper(c) || (c >= 'a' && c <= 'z');
|
||||
}
|
||||
|
||||
#endif // ALEEFORTH_CTYPE_HPP
|
||||
|
||||
|
@ -0,0 +1,20 @@
|
||||
# msp430 implementation
|
||||
|
||||
This is the MSP430 port of Alee Forth. It produces a binary that enters a REPL made available on the UART peripheral at 115200 baud. The specific target is MSP430G2553.
|
||||
|
||||
## Building
|
||||
|
||||
1. `make clean` (just in case)
|
||||
2. `make msp430-prep`: Builds `alee` for the host computer and uses it to create an `alee.dat` blob containing bytecode for `forth/core.fth` and `forth/msp430.fth`.
|
||||
3. `make msp430`: Produces `alee-msp430`, a standalone binary for the MSP430 with built-in core and msp430 word-sets.
|
||||
|
||||
The final binary is < 11 kB and provides 150 bytes for user dictionary in RAM (assuming 512 bytes of total RAM).
|
||||
|
||||
## msp430.fth
|
||||
|
||||
The msp430 word-set makes programming for the MSP430 easier:
|
||||
|
||||
* All register names are defined (P1OUT, ADC10MEM, etc.).
|
||||
* `r!` and `r@` to write and read device memory (i.e. registers).
|
||||
* `rset`, `rclr`, `rtgl` work like `r!` but set, clear, or toggle the given value/mask instead.
|
||||
|
@ -0,0 +1,9 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
cat msp430fr2476_symbols.ld | grep "^PROVIDE.*" | sed -e "s/^PROVIDE(//" -e "s/[ ][ ]*//" -e "s/=.0x/\\\\x/" -e "s/..);/\\\\x&/" -e "s/);//" > msp430fr2476_symbols.dat
|
||||
grep -E "^#define \w+\s+\([0-9].*$" msp430fr2476.h | sed -e "s/).*$/)/" -e "s/^#define //" -e "s/[ ][ ]*//" -e "s/(0x/\\\\x/" -e "s/..)/\\\\x&/" -e "s/)//" -e "s/(/\\\\x/" -e "s/\\\\x\\\\/\\\\x00\\\\/" > msp430fr2476.dat
|
||||
cat msp430fr2476_symbols.dat msp430fr2476.dat | tr '\n' '\373' | tr -d '\r' > msp430fr2476_all.dat
|
||||
echo -e "$(cat msp430fr2476_all.dat)" > msp430fr2476_all.bin
|
||||
./lzss e msp430fr2476_all.bin msp430fr2476_all.lzss
|
||||
ls -l msp430fr2476_all.lzss
|
||||
xxd -i msp430fr2476_all.lzss > msp430fr2476_all.h
|
@ -0,0 +1,15 @@
|
||||
unsigned char RXData = 0;
|
||||
unsigned char TXData;
|
||||
|
||||
: spi-init
|
||||
bit2 bit5 or bit6 or p3sel0 byte set
|
||||
ucb1ctlw0
|
||||
ucswrst over reg set
|
||||
ucmst ucsync or ucckpl or ucmsb or over reg set
|
||||
ucssel__aclk over reg set
|
||||
2 ucb1brw reg!
|
||||
ucswrst swap reg clear ;
|
||||
|
||||
: spi-emit
|
||||
begin ucb1ifg reg@ uctxifg and until
|
||||
ucb1txbuf reg! ;
|
@ -0,0 +1,13 @@
|
||||
\ UART example, 19200 baud, pins D0/1
|
||||
|
||||
: uart-init ( -- )
|
||||
bit5 bit6 or p2sel0 byte set
|
||||
ucswrst uca1ctlw0 reg set
|
||||
ucssel__smclk uca1ctlw0 reg set
|
||||
52 uca1brw reg!
|
||||
18688 ucos16 or ucbrf0 or uca1mctlw reg!
|
||||
ucswrst uca1ctlw0 reg clear ;
|
||||
|
||||
: uart-emit ( n -- )
|
||||
begin uca1ifg reg@ uctxifg and until
|
||||
uca1txbuf byte! ;
|
@ -0,0 +1,181 @@
|
||||
/* LZSS encoder-decoder (Haruhiko Okumura; public domain) */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define EI 8 /* typically 10..13 */
|
||||
#define EJ 3 /* typically 4..5 */
|
||||
#define P 1 /* If match length <= P then output one character */
|
||||
#define N (1 << EI) /* buffer size */
|
||||
#define F ((1 << EJ) + 1) /* lookahead buffer size */
|
||||
|
||||
int bit_buffer = 0, bit_mask = 128;
|
||||
unsigned long codecount = 0, textcount = 0;
|
||||
unsigned char buffer[N * 2];
|
||||
FILE *infile, *outfile;
|
||||
|
||||
void error(void)
|
||||
{
|
||||
printf("Output error\n"); exit(1);
|
||||
}
|
||||
|
||||
void putbit1(void)
|
||||
{
|
||||
bit_buffer |= bit_mask;
|
||||
if ((bit_mask >>= 1) == 0) {
|
||||
if (fputc(bit_buffer, outfile) == EOF) error();
|
||||
bit_buffer = 0; bit_mask = 128; codecount++;
|
||||
}
|
||||
}
|
||||
|
||||
void putbit0(void)
|
||||
{
|
||||
if ((bit_mask >>= 1) == 0) {
|
||||
if (fputc(bit_buffer, outfile) == EOF) error();
|
||||
bit_buffer = 0; bit_mask = 128; codecount++;
|
||||
}
|
||||
}
|
||||
|
||||
void flush_bit_buffer(void)
|
||||
{
|
||||
if (bit_mask != 128) {
|
||||
if (fputc(bit_buffer, outfile) == EOF) error();
|
||||
codecount++;
|
||||
}
|
||||
}
|
||||
|
||||
void output1(int c)
|
||||
{
|
||||
int mask;
|
||||
|
||||
putbit1();
|
||||
mask = 256;
|
||||
while (mask >>= 1) {
|
||||
if (c & mask) putbit1();
|
||||
else putbit0();
|
||||
}
|
||||
}
|
||||
|
||||
void output2(int x, int y)
|
||||
{
|
||||
int mask;
|
||||
|
||||
putbit0();
|
||||
mask = N;
|
||||
while (mask >>= 1) {
|
||||
if (x & mask) putbit1();
|
||||
else putbit0();
|
||||
}
|
||||
mask = (1 << EJ);
|
||||
while (mask >>= 1) {
|
||||
if (y & mask) putbit1();
|
||||
else putbit0();
|
||||
}
|
||||
}
|
||||
|
||||
void encode(void)
|
||||
{
|
||||
int i, j, f1, x, y, r, s, bufferend, c;
|
||||
|
||||
for (i = 0; i < N - F; i++) buffer[i] = ' ';
|
||||
for (i = N - F; i < N * 2; i++) {
|
||||
if ((c = fgetc(infile)) == EOF) break;
|
||||
buffer[i] = c; textcount++;
|
||||
}
|
||||
bufferend = i; r = N - F; s = 0;
|
||||
while (r < bufferend) {
|
||||
f1 = (F <= bufferend - r) ? F : bufferend - r;
|
||||
x = 0; y = 1; c = buffer[r];
|
||||
for (i = r - 1; i >= s; i--)
|
||||
if (buffer[i] == c) {
|
||||
for (j = 1; j < f1; j++)
|
||||
if (buffer[i + j] != buffer[r + j]) break;
|
||||
if (j > y) {
|
||||
x = i; y = j;
|
||||
}
|
||||
}
|
||||
if (y <= P) { y = 1; output1(c); }
|
||||
else output2(x & (N - 1), y - 2);
|
||||
r += y; s += y;
|
||||
if (r >= N * 2 - F) {
|
||||
for (i = 0; i < N; i++) buffer[i] = buffer[i + N];
|
||||
bufferend -= N; r -= N; s -= N;
|
||||
while (bufferend < N * 2) {
|
||||
if ((c = fgetc(infile)) == EOF) break;
|
||||
buffer[bufferend++] = c; textcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
flush_bit_buffer();
|
||||
printf("text: %ld bytes\n", textcount);
|
||||
printf("code: %ld bytes (%ld%%)\n",
|
||||
codecount, (codecount * 100) / textcount);
|
||||
}
|
||||
|
||||
int getbit(int n) /* get n bits */
|
||||
{
|
||||
int i, x;
|
||||
static int buf, mask = 0;
|
||||
|
||||
x = 0;
|
||||
for (i = 0; i < n; i++) {
|
||||
if (mask == 0) {
|
||||
if ((buf = fgetc(infile)) == EOF) return EOF;
|
||||
mask = 128;
|
||||
}
|
||||
x <<= 1;
|
||||
if (buf & mask) x++;
|
||||
mask >>= 1;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
void decode(void)
|
||||
{
|
||||
int i, j, k, r, c;
|
||||
|
||||
for (i = 0; i < N - F; i++) buffer[i] = ' ';
|
||||
r = N - F;
|
||||
while ((c = getbit(1)) != EOF) {
|
||||
if (c) {
|
||||
if ((c = getbit(8)) == EOF) break;
|
||||
fputc(c, outfile);
|
||||
buffer[r++] = c; r &= (N - 1);
|
||||
} else {
|
||||
if ((i = getbit(EI)) == EOF) break;
|
||||
if ((j = getbit(EJ)) == EOF) break;
|
||||
for (k = 0; k <= j + 1; k++) {
|
||||
c = buffer[(i + k) & (N - 1)];
|
||||
fputc(c, outfile);
|
||||
buffer[r++] = c; r &= (N - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int enc;
|
||||
char *s;
|
||||
|
||||
if (argc != 4) {
|
||||
printf("Usage: lzss e/d infile outfile\n\te = encode\td = decode\n");
|
||||
return 1;
|
||||
}
|
||||
s = argv[1];
|
||||
if (s[1] == 0 && (*s == 'd' || *s == 'D' || *s == 'e' || *s == 'E'))
|
||||
enc = (*s == 'e' || *s == 'E');
|
||||
else {
|
||||
printf("? %s\n", s); return 1;
|
||||
}
|
||||
if ((infile = fopen(argv[2], "rb")) == NULL) {
|
||||
printf("? %s\n", argv[2]); return 1;
|
||||
}
|
||||
if ((outfile = fopen(argv[3], "wb")) == NULL) {
|
||||
printf("? %s\n", argv[3]); return 1;
|
||||
}
|
||||
if (enc) encode(); else decode();
|
||||
fclose(infile); fclose(outfile);
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,74 @@
|
||||
/* LZSS encoder-decoder (Haruhiko Okumura; public domain) */
|
||||
/* Modified by Clyne Sullivan to focus on streamed decompression. */
|
||||
|
||||
#ifndef EOF
|
||||
#define EOF (-1)
|
||||
#endif
|
||||
|
||||
#define EI 8 /* typically 10..13 */
|
||||
#define EJ 3 /* typically 4..5 */
|
||||
#define N (1 << EI) /* buffer size */
|
||||
#define F ((1 << EJ) + 1) /* lookahead buffer size */
|
||||
|
||||
static unsigned char buffer[N * 2];
|
||||
static const unsigned char *inbuffer;
|
||||
static unsigned int insize, inidx;
|
||||
static int buf, mask;
|
||||
|
||||
/* Prepares decode() to decompress the given data. */
|
||||
void lzssinit(const unsigned char *inb, unsigned int ins)
|
||||
{
|
||||
inbuffer = inb;
|
||||
insize = ins;
|
||||
inidx = 0;
|
||||
buf = 0;
|
||||
mask = 0;
|
||||
}
|
||||
|
||||
int getbit(int n) /* get n bits */
|
||||
{
|
||||
int i, x;
|
||||
|
||||
x = 0;
|
||||
for (i = 0; i < n; i++) {
|
||||
if (mask == 0) {
|
||||
if (inidx >= insize)
|
||||
return EOF;
|
||||
buf = inbuffer[inidx++];
|
||||
mask = 128;
|
||||
}
|
||||
x <<= 1;
|
||||
if (buf & mask) x++;
|
||||
mask >>= 1;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
/* handleoutput() receives each decompressed byte, return zero if want more. */
|
||||
int decode(int (*handleoutput)(int))
|
||||
{
|
||||
int i, j, k, r, c, ret;
|
||||
|
||||
for (i = 0; i < N - F; i++) buffer[i] = ' ';
|
||||
r = N - F;
|
||||
while ((c = getbit(1)) != EOF) {
|
||||
if (c) {
|
||||
if ((c = getbit(8)) == EOF) break;
|
||||
if ((ret = handleoutput(c)))
|
||||
return ret;
|
||||
buffer[r++] =(unsigned char) c; r &= (N - 1);
|
||||
} else {
|
||||
if ((i = getbit(EI)) == EOF) break;
|
||||
if ((j = getbit(EJ)) == EOF) break;
|
||||
for (k = 0; k <= j + 1; k++) {
|
||||
c = buffer[(i + k) & (N - 1)];
|
||||
if ((ret = handleoutput(c)))
|
||||
return ret;
|
||||
buffer[r++] = (unsigned char)c; r &= (N - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return EOF;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,376 @@
|
||||
/* ============================================================================ */
|
||||
/* Copyright (c) 2021, Texas Instruments Incorporated */
|
||||
/* All rights reserved. */
|
||||
/* */
|
||||
/* Redistribution and use in source and binary forms, with or without */
|
||||
/* modification, are permitted provided that the following conditions */
|
||||
/* are met: */
|
||||
/* */
|
||||
/* * Redistributions of source code must retain the above copyright */
|
||||
/* notice, this list of conditions and the following disclaimer. */
|
||||
/* */
|
||||
/* * Redistributions in binary form must reproduce the above copyright */
|
||||
/* notice, this list of conditions and the following disclaimer in the */
|
||||
/* documentation and/or other materials provided with the distribution. */
|
||||
/* */
|
||||
/* * Neither the name of Texas Instruments Incorporated nor the names of */
|
||||
/* its contributors may be used to endorse or promote products derived */
|
||||
/* from this software without specific prior written permission. */
|
||||
/* */
|
||||
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" */
|
||||
/* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, */
|
||||
/* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
|
||||
/* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */
|
||||
/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
|
||||
/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
|
||||
/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; */
|
||||
/* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, */
|
||||
/* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */
|
||||
/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
|
||||
/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||
/* ============================================================================ */
|
||||
|
||||
/* This file supports MSP430FR2476 devices. */
|
||||
/* Version: 1.212 */
|
||||
/* Default linker script, for normal executables */
|
||||
|
||||
OUTPUT_ARCH(msp430)
|
||||
ENTRY(_start)
|
||||
|
||||
MEMORY {
|
||||
TINYRAM : ORIGIN = 0x0006, LENGTH = 0x001A /* END=0x001F, size 26 */
|
||||
BSL0 : ORIGIN = 0x1000, LENGTH = 0x0800 /* END=0x17FF, size 2048 */
|
||||
TLVMEM : ORIGIN = 0x1A00, LENGTH = 0x0200 /* END=0x1BFF, size 512 */
|
||||
BOOTCODE : ORIGIN = 0x1C00, LENGTH = 0x0400 /* END=0x1FFF, size 1024 */
|
||||
ROMLIB : ORIGIN = 0xC0000, LENGTH = 0x4000 /* END=0xC3FFF, size 16384 */
|
||||
BSL1 : ORIGIN = 0xFFC00, LENGTH = 0x0400 /* END=0xFFFFF, size 1024 */
|
||||
RAM (rwx) : ORIGIN = 0x2000, LENGTH = 0x2000 /* END=0x3FFF, size 8192 */
|
||||
INFOMEM : ORIGIN = 0x1800, LENGTH = 0x0200 /* END=0x19FF, size 512 */
|
||||
FRAM (rwx) : ORIGIN = 0x8000, LENGTH = 0x7F80 /* END=0xFF7F, size 32640 */
|
||||
HIFRAM (rxw) : ORIGIN = 0x10000, LENGTH = 0x00007FFF
|
||||
JTAGSIGNATURE : ORIGIN = 0xFF80, LENGTH = 0x0004
|
||||
BSLSIGNATURE : ORIGIN = 0xFF84, LENGTH = 0x0004
|
||||
BSLCONFIGURATIONSIGNATURE : ORIGIN = 0xFF88, LENGTH = 0x0002
|
||||
BSLCONFIGURATION : ORIGIN = 0xFF8A, LENGTH = 0x0002
|
||||
BSLI2CADDRESS : ORIGIN = 0xFFA0, LENGTH = 0x0002
|
||||
VECT0 : ORIGIN = 0xFFA2, LENGTH = 0x0002
|
||||
VECT1 : ORIGIN = 0xFFA4, LENGTH = 0x0002
|
||||
VECT2 : ORIGIN = 0xFFA6, LENGTH = 0x0002
|
||||
VECT3 : ORIGIN = 0xFFA8, LENGTH = 0x0002
|
||||
VECT4 : ORIGIN = 0xFFAA, LENGTH = 0x0002
|
||||
VECT5 : ORIGIN = 0xFFAC, LENGTH = 0x0002
|
||||
VECT6 : ORIGIN = 0xFFAE, LENGTH = 0x0002
|
||||
VECT7 : ORIGIN = 0xFFB0, LENGTH = 0x0002
|
||||
VECT8 : ORIGIN = 0xFFB2, LENGTH = 0x0002
|
||||
VECT9 : ORIGIN = 0xFFB4, LENGTH = 0x0002
|
||||
VECT10 : ORIGIN = 0xFFB6, LENGTH = 0x0002
|
||||
VECT11 : ORIGIN = 0xFFB8, LENGTH = 0x0002
|
||||
VECT12 : ORIGIN = 0xFFBA, LENGTH = 0x0002
|
||||
VECT13 : ORIGIN = 0xFFBC, LENGTH = 0x0002
|
||||
VECT14 : ORIGIN = 0xFFBE, LENGTH = 0x0002
|
||||
VECT15 : ORIGIN = 0xFFC0, LENGTH = 0x0002
|
||||
VECT16 : ORIGIN = 0xFFC2, LENGTH = 0x0002
|
||||
VECT17 : ORIGIN = 0xFFC4, LENGTH = 0x0002
|
||||
VECT18 : ORIGIN = 0xFFC6, LENGTH = 0x0002
|
||||
VECT19 : ORIGIN = 0xFFC8, LENGTH = 0x0002
|
||||
VECT20 : ORIGIN = 0xFFCA, LENGTH = 0x0002
|
||||
VECT21 : ORIGIN = 0xFFCC, LENGTH = 0x0002
|
||||
VECT22 : ORIGIN = 0xFFCE, LENGTH = 0x0002
|
||||
VECT23 : ORIGIN = 0xFFD0, LENGTH = 0x0002
|
||||
VECT24 : ORIGIN = 0xFFD2, LENGTH = 0x0002
|
||||
VECT25 : ORIGIN = 0xFFD4, LENGTH = 0x0002
|
||||
VECT26 : ORIGIN = 0xFFD6, LENGTH = 0x0002
|
||||
VECT27 : ORIGIN = 0xFFD8, LENGTH = 0x0002
|
||||
VECT28 : ORIGIN = 0xFFDA, LENGTH = 0x0002
|
||||
VECT29 : ORIGIN = 0xFFDC, LENGTH = 0x0002
|
||||
VECT30 : ORIGIN = 0xFFDE, LENGTH = 0x0002
|
||||
VECT31 : ORIGIN = 0xFFE0, LENGTH = 0x0002
|
||||
VECT32 : ORIGIN = 0xFFE2, LENGTH = 0x0002
|
||||
VECT33 : ORIGIN = 0xFFE4, LENGTH = 0x0002
|
||||
VECT34 : ORIGIN = 0xFFE6, LENGTH = 0x0002
|
||||
VECT35 : ORIGIN = 0xFFE8, LENGTH = 0x0002
|
||||
VECT36 : ORIGIN = 0xFFEA, LENGTH = 0x0002
|
||||
VECT37 : ORIGIN = 0xFFEC, LENGTH = 0x0002
|
||||
VECT38 : ORIGIN = 0xFFEE, LENGTH = 0x0002
|
||||
VECT39 : ORIGIN = 0xFFF0, LENGTH = 0x0002
|
||||
VECT40 : ORIGIN = 0xFFF2, LENGTH = 0x0002
|
||||
VECT41 : ORIGIN = 0xFFF4, LENGTH = 0x0002
|
||||
VECT42 : ORIGIN = 0xFFF6, LENGTH = 0x0002
|
||||
VECT43 : ORIGIN = 0xFFF8, LENGTH = 0x0002
|
||||
VECT44 : ORIGIN = 0xFFFA, LENGTH = 0x0002
|
||||
VECT45 : ORIGIN = 0xFFFC, LENGTH = 0x0002
|
||||
RESETVEC : ORIGIN = 0xFFFE, LENGTH = 0x0002
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.jtagsignature : {} > JTAGSIGNATURE
|
||||
.bslsignature : {} > BSLSIGNATURE
|
||||
.bslconfigsignature : {} > BSLCONFIGURATIONSIGNATURE
|
||||
.bslconfig : {} > BSLCONFIGURATION
|
||||
.bsli2caddress : {} > BSLI2CADDRESS
|
||||
|
||||
__interrupt_vector_0 : { KEEP (*(__interrupt_vector_0 )) } > VECT0
|
||||
__interrupt_vector_1 : { KEEP (*(__interrupt_vector_1 )) } > VECT1
|
||||
__interrupt_vector_2 : { KEEP (*(__interrupt_vector_2 )) } > VECT2
|
||||
__interrupt_vector_3 : { KEEP (*(__interrupt_vector_3 )) } > VECT3
|
||||
__interrupt_vector_4 : { KEEP (*(__interrupt_vector_4 )) } > VECT4
|
||||
__interrupt_vector_5 : { KEEP (*(__interrupt_vector_5 )) } > VECT5
|
||||
__interrupt_vector_6 : { KEEP (*(__interrupt_vector_6 )) } > VECT6
|
||||
__interrupt_vector_7 : { KEEP (*(__interrupt_vector_7 )) } > VECT7
|
||||
__interrupt_vector_8 : { KEEP (*(__interrupt_vector_8 )) } > VECT8
|
||||
__interrupt_vector_9 : { KEEP (*(__interrupt_vector_9 )) } > VECT9
|
||||
__interrupt_vector_10 : { KEEP (*(__interrupt_vector_10)) } > VECT10
|
||||
__interrupt_vector_11 : { KEEP (*(__interrupt_vector_11)) } > VECT11
|
||||
__interrupt_vector_12 : { KEEP (*(__interrupt_vector_12)) } > VECT12
|
||||
__interrupt_vector_13 : { KEEP (*(__interrupt_vector_13)) } > VECT13
|
||||
__interrupt_vector_14 : { KEEP (*(__interrupt_vector_14)) } > VECT14
|
||||
__interrupt_vector_15 : { KEEP (*(__interrupt_vector_15)) } > VECT15
|
||||
__interrupt_vector_16 : { KEEP (*(__interrupt_vector_16)) } > VECT16
|
||||
__interrupt_vector_17 : { KEEP (*(__interrupt_vector_17)) } > VECT17
|
||||
__interrupt_vector_18 : { KEEP (*(__interrupt_vector_18)) } > VECT18
|
||||
__interrupt_vector_19 : { KEEP (*(__interrupt_vector_19)) } > VECT19
|
||||
__interrupt_vector_20 : { KEEP (*(__interrupt_vector_20)) KEEP (*(__interrupt_vector_ecomp0)) } > VECT20
|
||||
__interrupt_vector_21 : { KEEP (*(__interrupt_vector_21)) KEEP (*(__interrupt_vector_port6)) } > VECT21
|
||||
__interrupt_vector_22 : { KEEP (*(__interrupt_vector_22)) KEEP (*(__interrupt_vector_port5)) } > VECT22
|
||||
__interrupt_vector_23 : { KEEP (*(__interrupt_vector_23)) KEEP (*(__interrupt_vector_port4)) } > VECT23
|
||||
__interrupt_vector_24 : { KEEP (*(__interrupt_vector_24)) KEEP (*(__interrupt_vector_port3)) } > VECT24
|
||||
__interrupt_vector_25 : { KEEP (*(__interrupt_vector_25)) KEEP (*(__interrupt_vector_port2)) } > VECT25
|
||||
__interrupt_vector_26 : { KEEP (*(__interrupt_vector_26)) KEEP (*(__interrupt_vector_port1)) } > VECT26
|
||||
__interrupt_vector_27 : { KEEP (*(__interrupt_vector_27)) KEEP (*(__interrupt_vector_adc)) } > VECT27
|
||||
__interrupt_vector_28 : { KEEP (*(__interrupt_vector_28)) KEEP (*(__interrupt_vector_eusci_b1)) } > VECT28
|
||||
__interrupt_vector_29 : { KEEP (*(__interrupt_vector_29)) KEEP (*(__interrupt_vector_eusci_b0)) } > VECT29
|
||||
__interrupt_vector_30 : { KEEP (*(__interrupt_vector_30)) KEEP (*(__interrupt_vector_eusci_a1)) } > VECT30
|
||||
__interrupt_vector_31 : { KEEP (*(__interrupt_vector_31)) KEEP (*(__interrupt_vector_eusci_a0)) } > VECT31
|
||||
__interrupt_vector_32 : { KEEP (*(__interrupt_vector_32)) KEEP (*(__interrupt_vector_wdt)) } > VECT32
|
||||
__interrupt_vector_33 : { KEEP (*(__interrupt_vector_33)) KEEP (*(__interrupt_vector_rtc)) } > VECT33
|
||||
__interrupt_vector_34 : { KEEP (*(__interrupt_vector_34)) KEEP (*(__interrupt_vector_timer0_b1)) } > VECT34
|
||||
__interrupt_vector_35 : { KEEP (*(__interrupt_vector_35)) KEEP (*(__interrupt_vector_timer0_b0)) } > VECT35
|
||||
__interrupt_vector_36 : { KEEP (*(__interrupt_vector_36)) KEEP (*(__interrupt_vector_timer3_a1)) } > VECT36
|
||||
__interrupt_vector_37 : { KEEP (*(__interrupt_vector_37)) KEEP (*(__interrupt_vector_timer3_a0)) } > VECT37
|
||||
__interrupt_vector_38 : { KEEP (*(__interrupt_vector_38)) KEEP (*(__interrupt_vector_timer2_a1)) } > VECT38
|
||||
__interrupt_vector_39 : { KEEP (*(__interrupt_vector_39)) KEEP (*(__interrupt_vector_timer2_a0)) } > VECT39
|
||||
__interrupt_vector_40 : { KEEP (*(__interrupt_vector_40)) KEEP (*(__interrupt_vector_timer1_a1)) } > VECT40
|
||||
__interrupt_vector_41 : { KEEP (*(__interrupt_vector_41)) KEEP (*(__interrupt_vector_timer1_a0)) } > VECT41
|
||||
__interrupt_vector_42 : { KEEP (*(__interrupt_vector_42)) KEEP (*(__interrupt_vector_timer0_a1)) } > VECT42
|
||||
__interrupt_vector_43 : { KEEP (*(__interrupt_vector_43)) KEEP (*(__interrupt_vector_timer0_a0)) } > VECT43
|
||||
__interrupt_vector_44 : { KEEP (*(__interrupt_vector_44)) KEEP (*(__interrupt_vector_unmi)) } > VECT44
|
||||
__interrupt_vector_45 : { KEEP (*(__interrupt_vector_45)) KEEP (*(__interrupt_vector_sysnmi)) } > VECT45
|
||||
__reset_vector :
|
||||
{
|
||||
KEEP (*(__interrupt_vector_46))
|
||||
KEEP (*(__interrupt_vector_reset))
|
||||
KEEP (*(.resetvec))
|
||||
} > RESETVEC
|
||||
|
||||
.rodata :
|
||||
{
|
||||
. = ALIGN(2);
|
||||
*(.rodata .rodata.* .gnu.linkonce.r.* .const .const:*)
|
||||
*(.rodata1)
|
||||
} > FRAM
|
||||
|
||||
/* Note: This is a separate .rodata section for sections which are
|
||||
read only but which older linkers treat as read-write.
|
||||
This prevents older linkers from marking the entire .rodata
|
||||
section as read-write. */
|
||||
.rodata2 :
|
||||
{
|
||||
. = ALIGN(2);
|
||||
PROVIDE (__preinit_array_start = .);
|
||||
KEEP (*(.preinit_array))
|
||||
PROVIDE (__preinit_array_end = .);
|
||||
. = ALIGN(2);
|
||||
PROVIDE (__init_array_start = .);
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array))
|
||||
PROVIDE (__init_array_end = .);
|
||||
. = ALIGN(2);
|
||||
PROVIDE (__fini_array_start = .);
|
||||
KEEP (*(.fini_array))
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
PROVIDE (__fini_array_end = .);
|
||||
. = ALIGN(2);
|
||||
|
||||
/* gcc uses crtbegin.o to find the start of the constructors, so
|
||||
we make sure it is first. Because this is a wildcard, it
|
||||
doesn't matter if the user does not actually link against
|
||||
crtbegin.o; the linker won't look for a file to match a
|
||||
wildcard. The wildcard also means that it doesn't matter which
|
||||
directory crtbegin.o is in. */
|
||||
KEEP (*crtbegin*.o(.ctors))
|
||||
|
||||
/* We don't want to include the .ctor section from the crtend.o
|
||||
file until after the sorted ctors. The .ctor section from
|
||||
the crtend file contains the end of ctors marker and it must
|
||||
be last */
|
||||
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
|
||||
KEEP (*crtbegin*.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
} > FRAM
|
||||
|
||||
.tinyram : {
|
||||
PROVIDE (__dict = .);
|
||||
} > TINYRAM
|
||||
|
||||
.libalee : {
|
||||
. = ALIGN(2);
|
||||
PROVIDE (__libaleedst = .);
|
||||
*(.libalee)
|
||||
} > RAM AT> FRAM
|
||||
PROVIDE(__libaleebegin = LOADADDR(.libalee));
|
||||
PROVIDE (__libaleeend = LOADADDR(.libalee) + SIZEOF(.libalee));
|
||||
|
||||
.data :
|
||||
{
|
||||
. = ALIGN(2);
|
||||
PROVIDE (__datastart = .);
|
||||
|
||||
*(.data .data.* .gnu.linkonce.d.*)
|
||||
KEEP (*(.gnu.linkonce.d.*personality*))
|
||||
SORT(CONSTRUCTORS)
|
||||
*(.data1)
|
||||
|
||||
/* We want the small data sections together, so single-instruction offsets
|
||||
can access them all, and initialized data all before uninitialized, so
|
||||
we can shorten the on-disk segment size. */
|
||||
. = ALIGN(2);
|
||||
*(.sdata .sdata.* .gnu.linkonce.s.* D_2 D_1)
|
||||
|
||||
. = ALIGN(2);
|
||||
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
PROVIDE (__dataend = .);
|
||||
} > RAM AT> FRAM
|
||||
|
||||
/* Note that crt0 assumes this is a multiple of two; all the
|
||||
start/stop symbols are also assumed word-aligned. */
|
||||
PROVIDE(__romdatastart = LOADADDR(.data));
|
||||
PROVIDE (__romdatacopysize = SIZEOF(.data));
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(2);
|
||||
PROVIDE (__bssstart = .);
|
||||
*(.sbss .sbss.*)
|
||||
*(.bss .bss.* .gnu.linkonce.b.*)
|
||||
. = ALIGN(2);
|
||||
*(COMMON)
|
||||
PROVIDE (__bssend = .);
|
||||
} > RAM
|
||||
PROVIDE (__bsssize = SIZEOF(.bss));
|
||||
|
||||
/* This section contains data that is not initialised during load
|
||||
or application reset. */
|
||||
.noinit (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(2);
|
||||
PROVIDE (__noinit_start = .);
|
||||
*(.noinit)
|
||||
. = ALIGN(2);
|
||||
PROVIDE (__noinit_end = .);
|
||||
} > RAM
|
||||
|
||||
.stack (ORIGIN (RAM) + LENGTH(RAM)) :
|
||||
{
|
||||
PROVIDE (__stack = .);
|
||||
*(.stack)
|
||||
}
|
||||
|
||||
.hidict :
|
||||
{
|
||||
. = ALIGN(2);
|
||||
*(.hidict)
|
||||
} > HIFRAM
|
||||
|
||||
.text :
|
||||
{
|
||||
PROVIDE (_start = .);
|
||||
|
||||
. = ALIGN(2);
|
||||
KEEP (*(SORT(.crt_*)))
|
||||
|
||||
. = ALIGN(2);
|
||||
*(.text .stub .text.* .gnu.linkonce.t.* .text:*)
|
||||
|
||||
. = ALIGN(2);
|
||||
KEEP (*(.init))
|
||||
KEEP (*(.fini))
|
||||
KEEP (*(.tm_clone_table))
|
||||
|
||||
. = ALIGN(2);
|
||||
PROVIDE (_etext = .);
|
||||
} > FRAM
|
||||
|
||||
.lodict :
|
||||
{
|
||||
. = ALIGN(1024);
|
||||
*(.lodict)
|
||||
} > FRAM
|
||||
|
||||
.info (NOLOAD) : {} > INFOMEM /* MSP430 INFO FLASH MEMORY SEGMENTS */
|
||||
|
||||
/* The rest are all not normally part of the runtime image. */
|
||||
|
||||
.MSP430.attributes 0 :
|
||||
{
|
||||
KEEP (*(.MSP430.attributes))
|
||||
KEEP (*(.gnu.attributes))
|
||||
KEEP (*(__TI_build_attributes))
|
||||
}
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1. */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions. */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2. */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2. */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions. */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* DWARF 3 */
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
/* DWARF Extension. */
|
||||
.debug_macro 0 : { *(.debug_macro) }
|
||||
|
||||
/DISCARD/ : { *(.note.GNU-stack .debug_loclists) }
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* Include peripherals memory map */
|
||||
/****************************************************************************/
|
||||
|
||||
INCLUDE msp430fr2476_symbols.ld
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,315 +0,0 @@
|
||||
/* ============================================================================ */
|
||||
/* Copyright (c) 2021, Texas Instruments Incorporated */
|
||||
/* All rights reserved. */
|
||||
/* */
|
||||
/* Redistribution and use in source and binary forms, with or without */
|
||||
/* modification, are permitted provided that the following conditions */
|
||||
/* are met: */
|
||||
/* */
|
||||
/* * Redistributions of source code must retain the above copyright */
|
||||
/* notice, this list of conditions and the following disclaimer. */
|
||||
/* */
|
||||
/* * Redistributions in binary form must reproduce the above copyright */
|
||||
/* notice, this list of conditions and the following disclaimer in the */
|
||||
/* documentation and/or other materials provided with the distribution. */
|
||||
/* */
|
||||
/* * Neither the name of Texas Instruments Incorporated nor the names of */
|
||||
/* its contributors may be used to endorse or promote products derived */
|
||||
/* from this software without specific prior written permission. */
|
||||
/* */
|
||||
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" */
|
||||
/* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, */
|
||||
/* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
|
||||
/* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */
|
||||
/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
|
||||
/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
|
||||
/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; */
|
||||
/* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, */
|
||||
/* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */
|
||||
/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
|
||||
/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||
/* ============================================================================ */
|
||||
|
||||
/* This file supports MSP430G2553 devices. */
|
||||
/* Version: 1.212 */
|
||||
/* Default linker script, for normal executables */
|
||||
|
||||
OUTPUT_ARCH(msp430)
|
||||
ENTRY(_start)
|
||||
|
||||
MEMORY {
|
||||
SFR : ORIGIN = 0x0000, LENGTH = 0x0010 /* END=0x0010, size 16 */
|
||||
RAM : ORIGIN = 0x0200, LENGTH = 0x0200 /* END=0x03FF, size 512 */
|
||||
INFOMEM : ORIGIN = 0x1000, LENGTH = 0x0100 /* END=0x10FF, size 256 as 4 64-byte segments */
|
||||
INFOA : ORIGIN = 0x10C0, LENGTH = 0x0040 /* END=0x10FF, size 64 */
|
||||
INFOB : ORIGIN = 0x1080, LENGTH = 0x0040 /* END=0x10BF, size 64 */
|
||||
INFOC : ORIGIN = 0x1040, LENGTH = 0x0040 /* END=0x107F, size 64 */
|
||||
INFOD : ORIGIN = 0x1000, LENGTH = 0x0040 /* END=0x103F, size 64 */
|
||||
ROM (rx) : ORIGIN = 0xC000, LENGTH = 0x3FDE /* END=0xFFDD, size 16350 */
|
||||
BSLSIGNATURE : ORIGIN = 0xFFDE, LENGTH = 0x0002
|
||||
VECT1 : ORIGIN = 0xFFE0, LENGTH = 0x0002
|
||||
VECT2 : ORIGIN = 0xFFE2, LENGTH = 0x0002
|
||||
VECT3 : ORIGIN = 0xFFE4, LENGTH = 0x0002
|
||||
VECT4 : ORIGIN = 0xFFE6, LENGTH = 0x0002
|
||||
VECT5 : ORIGIN = 0xFFE8, LENGTH = 0x0002
|
||||
VECT6 : ORIGIN = 0xFFEA, LENGTH = 0x0002
|
||||
VECT7 : ORIGIN = 0xFFEC, LENGTH = 0x0002
|
||||
VECT8 : ORIGIN = 0xFFEE, LENGTH = 0x0002
|
||||
VECT9 : ORIGIN = 0xFFF0, LENGTH = 0x0002
|
||||
VECT10 : ORIGIN = 0xFFF2, LENGTH = 0x0002
|
||||
VECT11 : ORIGIN = 0xFFF4, LENGTH = 0x0002
|
||||
VECT12 : ORIGIN = 0xFFF6, LENGTH = 0x0002
|
||||
VECT13 : ORIGIN = 0xFFF8, LENGTH = 0x0002
|
||||
VECT14 : ORIGIN = 0xFFFA, LENGTH = 0x0002
|
||||
VECT15 : ORIGIN = 0xFFFC, LENGTH = 0x0002
|
||||
RESETVEC : ORIGIN = 0xFFFE, LENGTH = 0x0002
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.bslsignature : {} > BSLSIGNATURE
|
||||
__interrupt_vector_1 : { KEEP (*(__interrupt_vector_1 )) KEEP (*(__interrupt_vector_trapint)) } > VECT1
|
||||
__interrupt_vector_2 : { KEEP (*(__interrupt_vector_2 )) } > VECT2
|
||||
__interrupt_vector_3 : { KEEP (*(__interrupt_vector_3 )) KEEP (*(__interrupt_vector_port1)) } > VECT3
|
||||
__interrupt_vector_4 : { KEEP (*(__interrupt_vector_4 )) KEEP (*(__interrupt_vector_port2)) } > VECT4
|
||||
__interrupt_vector_5 : { KEEP (*(__interrupt_vector_5 )) } > VECT5
|
||||
__interrupt_vector_6 : { KEEP (*(__interrupt_vector_6 )) KEEP (*(__interrupt_vector_adc10)) } > VECT6
|
||||
__interrupt_vector_7 : { KEEP (*(__interrupt_vector_7 )) KEEP (*(__interrupt_vector_usciab0tx)) } > VECT7
|
||||
__interrupt_vector_8 : { KEEP (*(__interrupt_vector_8 )) KEEP (*(__interrupt_vector_usciab0rx)) } > VECT8
|
||||
__interrupt_vector_9 : { KEEP (*(__interrupt_vector_9 )) KEEP (*(__interrupt_vector_timer0_a1)) } > VECT9
|
||||
__interrupt_vector_10 : { KEEP (*(__interrupt_vector_10)) KEEP (*(__interrupt_vector_timer0_a0)) } > VECT10
|
||||
__interrupt_vector_11 : { KEEP (*(__interrupt_vector_11)) KEEP (*(__interrupt_vector_wdt)) } > VECT11
|
||||
__interrupt_vector_12 : { KEEP (*(__interrupt_vector_12)) KEEP (*(__interrupt_vector_comparatora)) } > VECT12
|
||||
__interrupt_vector_13 : { KEEP (*(__interrupt_vector_13)) KEEP (*(__interrupt_vector_timer1_a1)) } > VECT13
|
||||
__interrupt_vector_14 : { KEEP (*(__interrupt_vector_14)) KEEP (*(__interrupt_vector_timer1_a0)) } > VECT14
|
||||
__interrupt_vector_15 : { KEEP (*(__interrupt_vector_15)) KEEP (*(__interrupt_vector_nmi)) } > VECT15
|
||||
__reset_vector :
|
||||
{
|
||||
KEEP (*(__interrupt_vector_16))
|
||||
KEEP (*(__interrupt_vector_reset))
|
||||
KEEP (*(.resetvec))
|
||||
} > RESETVEC
|
||||
|
||||
.rodata :
|
||||
{
|
||||
. = ALIGN(2);
|
||||
*(.plt)
|
||||
*(.rodata .rodata.* .gnu.linkonce.r.* .const .const:*)
|
||||
*(.rodata1)
|
||||
KEEP (*(.gcc_except_table)) *(.gcc_except_table.*)
|
||||
} > ROM
|
||||
|
||||
/* Note: This is a separate .rodata section for sections which are
|
||||
read only but which older linkers treat as read-write.
|
||||
This prevents older linkers from marking the entire .rodata
|
||||
section as read-write. */
|
||||
.rodata2 :
|
||||
{
|
||||
. = ALIGN(2);
|
||||
PROVIDE (__preinit_array_start = .);
|
||||
KEEP (*(.preinit_array))
|
||||
PROVIDE (__preinit_array_end = .);
|
||||
. = ALIGN(2);
|
||||
PROVIDE (__init_array_start = .);
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array))
|
||||
PROVIDE (__init_array_end = .);
|
||||
. = ALIGN(2);
|
||||
PROVIDE (__fini_array_start = .);
|
||||
KEEP (*(.fini_array))
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
PROVIDE (__fini_array_end = .);
|
||||
/* . = ALIGN(2);
|
||||
*(.eh_frame_hdr)
|
||||
KEEP (*(.eh_frame)) */
|
||||
|
||||
/* gcc uses crtbegin.o to find the start of the constructors, so
|
||||
we make sure it is first. Because this is a wildcard, it
|
||||
doesn't matter if the user does not actually link against
|
||||
crtbegin.o; the linker won't look for a file to match a
|
||||
wildcard. The wildcard also means that it doesn't matter which
|
||||
directory crtbegin.o is in. */
|
||||
KEEP (*crtbegin*.o(.ctors))
|
||||
|
||||
/* We don't want to include the .ctor section from the crtend.o
|
||||
file until after the sorted ctors. The .ctor section from
|
||||
the crtend file contains the end of ctors marker and it must
|
||||
be last */
|
||||
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
|
||||
KEEP (*crtbegin*.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
} > ROM
|
||||
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(2);
|
||||
PROVIDE (_start = .);
|
||||
KEEP (*(SORT(.crt_*)))
|
||||
*(.lowtext .text .stub .text.* .gnu.linkonce.t.* .text:*)
|
||||
KEEP (*(.text.*personality*))
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
*(.interp .hash .dynsym .dynstr .gnu.version*)
|
||||
PROVIDE (__etext = .);
|
||||
PROVIDE (_etext = .);
|
||||
PROVIDE (etext = .);
|
||||
. = ALIGN(2);
|
||||
KEEP (*(.init))
|
||||
KEEP (*(.fini))
|
||||
KEEP (*(.tm_clone_table))
|
||||
} > ROM
|
||||
|
||||
.data :
|
||||
{
|
||||
. = ALIGN(2);
|
||||
PROVIDE (__datastart = .);
|
||||
|
||||
KEEP (*(.jcr))
|
||||
*(.data.rel.ro.local) *(.data.rel.ro*)
|
||||
*(.dynamic)
|
||||
|
||||
*(.data .data.* .gnu.linkonce.d.*)
|
||||
KEEP (*(.gnu.linkonce.d.*personality*))
|
||||
SORT(CONSTRUCTORS)
|
||||
*(.data1)
|
||||
*(.got.plt) *(.got)
|
||||
|
||||
/* We want the small data sections together, so single-instruction offsets
|
||||
can access them all, and initialized data all before uninitialized, so
|
||||
we can shorten the on-disk segment size. */
|
||||
. = ALIGN(2);
|
||||
*(.sdata .sdata.* .gnu.linkonce.s.* D_2 D_1)
|
||||
|
||||
. = ALIGN(2);
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
PROVIDE (__dataend = .);
|
||||
} > RAM AT>ROM
|
||||
|
||||
/* Note that crt0 assumes this is a multiple of two; all the
|
||||
start/stop symbols are also assumed word-aligned. */
|
||||
PROVIDE(__romdatastart = LOADADDR(.data));
|
||||
PROVIDE (__romdatacopysize = SIZEOF(.data));
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(2);
|
||||
PROVIDE (__bssstart = .);
|
||||
*(.dynbss)
|
||||
*(.sbss .sbss.*)
|
||||
*(.bss .bss.* .gnu.linkonce.b.*)
|
||||
. = ALIGN(2);
|
||||
*(COMMON)
|
||||
PROVIDE (__bssend = .);
|
||||
} > RAM
|
||||
PROVIDE (__bsssize = SIZEOF(.bss));
|
||||
|
||||
/* This section contains data that is not initialised during load
|
||||
or application reset. */
|
||||
.noinit (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(2);
|
||||
PROVIDE (__noinit_start = .);
|
||||
*(.noinit)
|
||||
. = ALIGN(2);
|
||||
PROVIDE (__noinit_end = .);
|
||||
end = .;
|
||||
} > RAM
|
||||
|
||||
/* We create this section so that "end" will always be in the
|
||||
RAM region (matching .stack below), even if the .bss
|
||||
section is empty. */
|
||||
.heap (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(2);
|
||||
__heap_start__ = .;
|
||||
_end = __heap_start__;
|
||||
PROVIDE (end = .);
|
||||
KEEP (*(.heap))
|
||||
_end = .;
|
||||
PROVIDE (end = .);
|
||||
/* This word is here so that the section is not empty, and thus
|
||||
not discarded by the linker. The actual value does not matter
|
||||
and is ignored. */
|
||||
LONG(0);
|
||||
__heap_end__ = .;
|
||||
__HeapLimit = __heap_end__;
|
||||
} > RAM
|
||||
/* WARNING: Do not place anything in RAM here.
|
||||
The heap section must be the last section in RAM and the stack
|
||||
section must be placed at the very end of the RAM region. */
|
||||
|
||||
.stack (ORIGIN (RAM) + LENGTH(RAM)) :
|
||||
{
|
||||
PROVIDE (__stack = .);
|
||||
*(.stack)
|
||||
}
|
||||
|
||||
.infoA : {} > INFOA /* MSP430 INFO FLASH MEMORY SEGMENTS */
|
||||
.infoB : {} > INFOB
|
||||
.infoC : {} > INFOC
|
||||
.infoD : {} > INFOD
|
||||
|
||||
/* The rest are all not normally part of the runtime image. */
|
||||
|
||||
.MSP430.attributes 0 :
|
||||
{
|
||||
KEEP (*(.MSP430.attributes))
|
||||
KEEP (*(.gnu.attributes))
|
||||
KEEP (*(__TI_build_attributes))
|
||||
}
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1. */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions. */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2. */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2. */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions. */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* DWARF 3 */
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
/* DWARF Extension. */
|
||||
.debug_macro 0 : { *(.debug_macro) }
|
||||
|
||||
/DISCARD/ : { *(.note.GNU-stack) }
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* Include peripherals memory map */
|
||||
/****************************************************************************/
|
||||
|
||||
INCLUDE msp430g2553_symbols.ld
|
||||
|
@ -0,0 +1,80 @@
|
||||
/**
|
||||
* Alee Forth: A portable and concise Forth implementation in modern C++.
|
||||
* Copyright (C) 2023 Clyne Sullivan <clyne@bitgloo.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ALEEFORTH_SPLITMEMDICTRW_HPP
|
||||
#define ALEEFORTH_SPLITMEMDICTRW_HPP
|
||||
|
||||
#include "libalee/alee.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
template<unsigned long int LON, unsigned long int HIN>
|
||||
class SplitMemDictRW : public Dictionary
|
||||
{
|
||||
uint8_t *lodict;
|
||||
uint32_t hidict;
|
||||
|
||||
public:
|
||||
constexpr explicit SplitMemDictRW(uint8_t *lo, uint32_t hi):
|
||||
lodict(lo), hidict(hi) {}
|
||||
|
||||
constexpr SplitMemDictRW(const SplitMemDictRW<LON, HIN>& spd):
|
||||
SplitMemDictRW(spd.lodict, spd.hidict) {}
|
||||
constexpr auto& operator=(const SplitMemDictRW<LON, HIN>& spd) {
|
||||
*this = SplitMemDictRW(spd.lodict, hidict);
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual Cell read(Addr addr) const noexcept final {
|
||||
if (addr < LON)
|
||||
return *reinterpret_cast<const Cell *>(lodict + addr);
|
||||
else
|
||||
return _data20_read_short(hidict + addr - LON);
|
||||
}
|
||||
|
||||
virtual void write(Addr addr, Cell value) noexcept final {
|
||||
if (addr < LON)
|
||||
*reinterpret_cast<Cell *>(lodict + addr) = value;
|
||||
else
|
||||
_data20_write_short(hidict + addr - LON, value);
|
||||
}
|
||||
|
||||
virtual uint8_t readbyte(Addr addr) const noexcept final {
|
||||
if (addr < LON)
|
||||
return lodict[addr];
|
||||
else
|
||||
return _data20_read_char(hidict + addr - LON);
|
||||
}
|
||||
|
||||
virtual void writebyte(Addr addr, uint8_t value) noexcept final {
|
||||
if (addr < LON)
|
||||
lodict[addr] = value;
|
||||
else
|
||||
_data20_write_char(hidict + addr - LON, value);
|
||||
}
|
||||
|
||||
virtual unsigned long int capacity() const noexcept final {
|
||||
return LON + HIN;
|
||||
}
|
||||
|
||||
private:
|
||||
virtual ~SplitMemDictRW() override {};
|
||||
};
|
||||
|
||||
#endif // ALEEFORTH_SPLITMEMDICTRW_HPP
|
||||
|
@ -0,0 +1 @@
|
||||
Subproject commit 45b7ecc1e37d8fdd1bd9a29ec52a15bf7ac69d7f
|
Loading…
Reference in New Issue