]> code.bitgloo.com Git - bitgloo/alee-forth.git/commitdiff
running on the devboard
authorClyne Sullivan <clyne@bitgloo.com>
Fri, 3 Nov 2023 00:50:47 +0000 (20:50 -0400)
committerClyne Sullivan <clyne@bitgloo.com>
Fri, 3 Nov 2023 00:50:47 +0000 (20:50 -0400)
Makefile
libalee/corewords.cpp
libalee/state.hpp
msp430/alee-msp430.cpp
msp430/msp430fr2476.ld

index beaea6b70529002fbbd1920b7926fe8d9da6b2c5..c0c818a6eeaa198c90a1d8e6da82f0c411d9c1e2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -16,10 +16,11 @@ msp430: CXXFLAGS += -I. -I/usr/msp430-elf/usr/include
 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
@@ -45,7 +46,7 @@ $(LIBFILE): $(OBJFILES)
 
 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)
index 8f903e1d6a5bc0bc8fa8b1ebd3b08c52d6708e2c..e3ba6b3b05513ea13eabce3d00a02cdf6378997e 100644 (file)
@@ -180,13 +180,10 @@ execute:
         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
index 12a3aebc2e9a2748f16dd3bbcce2a61a10da4b27..e77a223bd7375323a235e951c8d3fdc07ecd7d69 100644 (file)
@@ -25,8 +25,8 @@
 #include <csetjmp>
 #include <cstddef>
 
-constexpr unsigned DataStackSize = 16;
-constexpr unsigned ReturnStackSize = 16;
+constexpr unsigned DataStackSize = 64;
+constexpr unsigned ReturnStackSize = 64;
 
 class State
 {
index fba9c6f43adf41ef1e45c5d56c5027facce4a39e..92f3aa5152c3d2ecaebce273aad4e13d9e90ca29 100644 (file)
 
 #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);
@@ -38,14 +40,19 @@ static void initUART();
 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");
index 011683b236f4c393b74894e8e2257dd6369c80eb..62004bd74f7e1b8d526cd75ac460aa5c2712e7d3 100644 (file)
@@ -224,11 +224,6 @@ SECTIONS
     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
@@ -281,19 +276,6 @@ SECTIONS
   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
@@ -313,16 +295,6 @@ SECTIONS
   } > 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
@@ -395,12 +367,6 @@ SECTIONS
     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