msp430: CXXFLAGS += -Os -mmcu=msp430fr2476 -ffunction-sections -fdata-sections
msp430: CXXFLAGS += -DMEMDICTSIZE=1024 -flto -fno-asynchronous-unwind-tables -fno-threadsafe-statics -fno-stack-protector
msp430: LDFLAGS += -L/usr/msp430-elf/usr/include -Tmsp430/msp430fr2476.ld -Wl,-gc-sections
-msp430: clean-lib msp430/alee-msp430
+msp430: msp430/alee-msp430
msp430-prep: STANDALONE += forth/msp430.fth
msp430-prep: core.fth.h
+msp430-prep: clean-lib
small: CXXFLAGS += -Os -fno-asynchronous-unwind-tables -fno-threadsafe-statics -fno-stack-protector
small: alee
core.fth.h: alee.dat
xxd -i $< > $@
- sed -i "s/unsigned /static const &/" $@
+ sed -i "s/unsigned /static &/" $@
alee.dat: alee $(STANDALONE)
echo "3 sys" | ./alee $(STANDALONE)
cell = state.pop();
dcell = cell - state.dict.latest();
if (dcell > (1 << (sizeof(Cell) * 8 - 6)) - 1) {
- state.dict.write(cell,
- (state.dict.read(cell) & 0x1F) | static_cast<Cell>(((1 << (sizeof(Cell) * 8 - 6)) - 1) << 6));
state.dict.write(static_cast<Addr>(cell) + sizeof(Cell), static_cast<Cell>(dcell));
- } else {
- state.dict.write(cell,
- (state.dict.read(cell) & 0x1F) | static_cast<Cell>(dcell << 6));
+ dcell = ((1 << (sizeof(Cell) * 8 - 6)) - 1);
}
+ state.dict.write(cell, (state.dict.read(cell) & 0x1F) | static_cast<Cell>(dcell << 6));
state.dict.latest(cell);
break;
case 27: // _jmp0
#include <csetjmp>
#include <cstddef>
-constexpr unsigned DataStackSize = 16;
-constexpr unsigned ReturnStackSize = 16;
+constexpr unsigned DataStackSize = 64;
+constexpr unsigned ReturnStackSize = 64;
class State
{
#include "alee.hpp"
#include "libalee/ctype.hpp"
-#include "splitmemdict.hpp"
#include <msp430.h>
+#include "splitmemdictrw.hpp"
+
alignas(sizeof(Cell))
+__attribute__((section(".text")))
#include "core.fth.h"
-static char strbuf[32];
+static char strbuf[80];
static void readchar(State& state);
static void serput(int c);
static void Software_Trim();
#define MCLK_FREQ_MHZ (8) // MCLK = 8MHz
+//__attribute__((section(".upper.bss")))
+//static uint8_t hidict[16384];
+
int main()
{
WDTCTL = WDTPW | WDTHOLD;
initGPIO();
initClock();
initUART();
+ SYSCFG0 = FRWPPW;
- static SplitMemDict<alee_dat_len> dict (alee_dat);
+ (void)alee_dat_len;
+ static SplitMemDictRW<sizeof(alee_dat), /*sizeof(hidict)*/16384> dict (alee_dat, 0x10000/*(uint32_t)hidict*/);
State state (dict, readchar);
serputs("alee forth\n\r");
KEEP (*(.dtors))\r
} > FRAM\r
\r
- .upper.rodata :\r
- {\r
- *(.upper.rodata.* .upper.rodata)\r
- } > HIFRAM\r
-\r
/* This section contains data that is initialised during load\r
but not on application reset. */\r
.persistent :\r
PROVIDE(__romdatastart = LOADADDR(.lower.data));\r
PROVIDE (__romdatacopysize = SIZEOF(.lower.data) + SIZEOF(.data));\r
\r
- .upper.data :\r
- {\r
- __upper_data_init = LOADADDR (.upper.data);\r
- /* Status word. */\r
- SHORT(1);\r
- __high_datastart = .;\r
- *(.upper.data.* .upper.data)\r
- __high_dataend = .;\r
- } > HIFRAM AT> FRAM\r
-\r
- __rom_highdatacopysize = SIZEOF(.upper.data) - 2;\r
- __rom_highdatastart = LOADADDR(.upper.data) + 2;\r
-\r
.lower.bss :\r
{\r
. = ALIGN(2);\r
} > RAM\r
PROVIDE (__bsssize = SIZEOF(.lower.bss) + SIZEOF(.bss));\r
\r
- .upper.bss :\r
- {\r
- . = ALIGN(2);\r
- __high_bssstart = .;\r
- *(.upper.bss.* .upper.bss)\r
- . = ALIGN(2);\r
- __high_bssend = .;\r
- } > HIFRAM\r
- __high_bsssize = SIZEOF(.upper.bss);\r
-\r
/* This section contains data that is not initialised during load\r
or application reset. */\r
.noinit (NOLOAD) :\r
KEEP (*(.tm_clone_table))\r
} > FRAM\r
\r
- .upper.text :\r
- {\r
- . = ALIGN(2);\r
- *(.upper.text.* .upper.text)\r
- } > HIFRAM\r
-\r
.info (NOLOAD) : {} > INFOMEM /* MSP430 INFO FLASH MEMORY SEGMENTS */\r
\r
/* The rest are all not normally part of the runtime image. */\r