PDA

View Full Version : SAVE-RAM is missing


Pacetech
03-06-07, 09:12 PM
On page 49 of the ARM manual, it says we must use "SAVE-RAM" but it is not defined.

Do we still need it?

This code works - without storing it to flash


COLD
SCRUB

MACHINE REDBLINK
ON-MACHINE REDBLINK

APPEND-STATE LEDON
APPEND-STATE LEDOFF

IN-STATE
LEDON
CONDITION
-1
CAUSES
REDLED ON
THEN-STATE
LEDOFF
NEXT-TIME

IN-STATE
LEDOFF
CONDITION
-1
CAUSES
REDLED OFF
THEN-STATE
LEDON
NEXT-TIME

MACHINE-CHAIN RUN-STATES
REDBLINK
END-MACHINE-CHAIN

DECIMAL

: RUN-MACHINES ( -- )
LEDON SET-STATE INSTALL REDBLINK
EVERY 50000 CYCLES SCHEDULE-RUNS RUN-STATES
;

When I try to move the code to FLash, I used this:

COLD
SCRUB

MACHINE REDBLINK FLWORD
ON-MACHINE REDBLINK

APPEND-STATE LEDON FLWORD
APPEND-STATE LEDOFF FLWORD

IN-STATE
LEDON
CONDITION
-1
CAUSES
REDLED ON
THEN-STATE
LEDOFF
NEXT-TIME IN-EE

IN-STATE
LEDOFF
CONDITION
-1
CAUSES
REDLED OFF
THEN-STATE
LEDON
NEXT-TIME IN-EE

MACHINE-CHAIN RUN-STATES
REDBLINK
END-MACHINE-CHAIN FLWORD

DECIMAL

: RUN-MACHINES ( -- )
LEDON SET-STATE INSTALL REDBLINK
EVERY 50000 CYCLES SCHEDULE-RUNS RUN-STATES
; FLWORD


Whenever I execute "RUN-MACHINES", its locks up. Is there something I am missing? Do I need to use SAVE-RAM, which isn't in the ARM FORTH!

Also, TOGGLE doesn't work with REDLED, GRNLED OR YELLED.

One more thing I noticed

If I don't use FLWORD one one word, it shows as follows


COLD
IsoMax V1.0 Preliminary
SCRUB
IsoMax V1.0 Preliminary
: TEST1 ." TEST1" CR ; OK
: TEST2 ." TEST2" CR ; FLWORD OK
OK
OK
WORDS
8010 TEST2 40000898 TEST1 155C TASK
A10 ( 27AC @ 2750 C@
285C ! 2754 C! 33C 2@


So TEST1 is at 400000898, which is in RAM and TEST2 is at 8010, user flash. Sounds good

Now when I type WORD, there are a few words with a 40000XXX address:
40000030 GRNLED
40000020 REDLED
40000028 YELLED
40000010 IOSET
40000000 IOPIN
40000008 IODIR
40000018 IOCLR

These show they are stored in RAM right? Could it be that these words were not stored to flash properly?

And when putting variables in FLASH, I can't get this to work either. Trying to store a value to a variable locks up the POD.

COLD
IsoMax V1.0 Preliminary
SCRUB
IsoMax V1.0 Preliminary
VARIABLE TEST FLWORD OK
0 TEST !


Can anyone provide me with a working example of a program using state machines and stored into FLASH and AUTOSTARTS?

twe
03-21-07, 05:17 AM
For a set of tools to manage the flash space on the arm 2129, please
download the file "IsoMax4ARMbeta2129.F" to your 2129 board.
http://www.ece.ualberta.ca/~rchapman/TechTips/IsoMax4ARMbeta2129.F.zip
Once the file is downloaded, it will install itself in flash and be there for
reboots. Using the tools you can add your own programs on top and in
flash. You can boot into you program upon reset and run it. Below is
a screen dump of loading the tools, adding a simple hello world app,
removing it, removing the tools and dictionary checks along the way.
The [RESET] is when the reset button has been pressed:

[RESET]
IsoMax V1.0 Preliminary
OK
HEX NO-MACHINES 20000 1D000 FLERASE ( 2129 only ) SCRUB
IsoMax V1.0 Preliminary
OK
OK
OK
OK
OK
OK
OK
OK
OK
S ******************************************************************************************************
**************************************************
.MACHINES NOT UNIQUE *****
NO-MACHINES NOT UNIQUE ****************************************
END NOT UNIQUE ********************
IsoMax for ARM Beta 7
OK

[RESET]
IsoMax for ARM Beta 7
OK
OK
WORDS
40001948 ISOMAXBETA 400018BC INIT 40001890 STARTMAX
4000186C 'CURCOND 4000180C STATEMAX 400017D0 ENDMAX
400017A0 END 40001788 START 40001740 .CURSTATE
40001668 .STATE 400015BC .STATES 400015A4 XSTAT
4000158C DTAG 40001564 'COND 4000153C 'DTAG
4000151C 'STATE 40001500 'PARENT
40001438 INTS 400013C8 NO-MACHINES 40001324 .MACHINES
400012EC .H 40001284 CFA>NFA 400011C8 NO-ASM
4000117C USE-ASM 40001090 (USE-ASM) 40001074 ADC0
4000105C EINT3 40001044 EINT2 4000102C EINT1
40001014 EINT0 40000FFC RTC 40000FE8 PLL
40000FD4 SPI1 40000FBC SPI0 40000FA4 I2C0
40000F8C PWM0 40000F74 UART1 40000F5C UART0
40000F44 TIMER1 40000F2C TIMER0 40000F14 DBTX
40000EFC DBRX 40000EE4 SWI 40000ED0 WDT
40000E98 BADINTS 40000E80 badints 40000E0C LEDS
40000DD8 LEDS-ON 40000DA4 BIT-CLR 40000D74 BIT-SET
40000D00 P. 40000C84 " 40000C5C `
40000C48 SPI1_SPICR 40000C2C SPI1_SPMIS 40000C10 SPI1_SPRIS
40000BF4 SPI1_SPIMSC 40000BD8 SPI1_SPCPSR 40000BBC SPI1_SPCR1
40000BA0 SPI1_SPCR0 40000B84 AD0DR 40000B6C AD0CR
40000B54 TIMER1_CCR 40000B04 -AUTOBOOT 400009A0 BOOTUP
4000090C BOOTSTRAP 400008F0 CELL 400008D8 BOOT-VECT
400008BC RAM-START 1574 TASK A28 (
27C4 @ 2768 C@ 2874 !
( --- SPACE to proceed ESC to abort. --- )

: HI INIT ." HELLO " CR QUIT ; ' HI BOOTUP OK

[RESET]
HELLO

WORDS
40001984 HI 40001948 ISOMAXBETA 400018BC INIT
40001890 STARTMAX 4000186C 'CURCOND 4000180C STATEMAX
( --- SPACE to proceed ESC to abort. --- )
FORGET HI OK
' ISOMAXBETA BOOTUP OK

[RESET]
IsoMax for ARM Beta 7
-AUTOBOOT
IsoMax V1.0 Preliminary

[RESET]
IsoMax V1.0 Preliminary
WORDS
1574 TASK A28 ( 27C4 @
2768 C@ 2874 ! 276C C!
354 2@ 344 2! 1890 :
18B4 ; 282C + 2808 -
128 1-!
( --- SPACE to proceed ESC to abort. --- )

You can add state machines as well and it will all work as above. You
can time software execution with START and END. Below are examples,
interpreted, compiled and executed:

START END 144 uS OK
: Z START END ; OK
Z 1 uS OK

TWE

twe
03-21-07, 02:15 PM
This is an example of how to run the red led blinker state machine on
top of the bootup tools:

[RESET]
IsoMax for ARM Beta 7
OK
\ COLD OK
\ SCRUB OK
OK
MACHINE REDBLINK OK
ON-MACHINE REDBLINK OK
OK
APPEND-STATE LEDON OK
APPEND-STATE LEDOFF OK
OK
IN-STATE OK
LEDON OK
CONDITION
-1
CAUSES
REDLED ON
THEN-STATE OK
LEDOFF OK
NEXT-TIME OK
OK
IN-STATE OK
LEDOFF OK
CONDITION
-1
CAUSES
REDLED OFF
THEN-STATE OK
LEDON OK
NEXT-TIME OK
OK
MACHINE-CHAIN RUN-STATES
REDBLINK
END-MACHINE-CHAIN OK
OK
DECIMAL OK
OK
: RUN-MACHINES ( -- )
LEDON SET-STATE INSTALL REDBLINK
EVERY 50000 CYCLES SCHEDULE-RUNS RUN-STATES
; OK
OK
: Z INIT RUN-MACHINES QUIT ; ' Z BOOTUP OK

[RESET]
.MACHINES
SSMs: REDBLINK
ASMs: OK
NO-MACHINES OK
FORGET REDBLINK OK
' ISOMAXBETA BOOTUP OK

[RESET]
IsoMax for ARM Beta 7
WORDS
4000193C ISOMAXBETA 400018B0 INIT 40001884 STARTMAX
( --- SPACE to proceed ESC to abort. --- )

If you don't want the echo back of the downloaded text, you can use S
and QUIT as the first and last lines in your file. Then you will get
a download like:

S **********************************

where each * is for one line of text.

Things to note:
the word INIT must be called first to initialize the underlying machinery
the word QUIT must be called to start the text intepreter. Otherwise the boot sequence will give control back to the bootloader and just the IsoMax V1.0 Preliminary kernel will be resident
for larger programs, it is quicker to just develop in ram until you need to do rommed testing. Just don't do the BOOTUP step till needed.
to remove just your code, don't use COLD or SCRUB, use FORGET REDBLINK or whatever the first word is in your code. Simpler yet is to just press the reset button as the tools always startup with what is in flash only. So for the quickest development cycle, download to ram and use the reset button to reset the dictionary. If you save to flash with BOOTUP, then you will need to FORGET your code to remove it from the dictionary.
Before you remove your code from the dictionary, it is best to make sure none of it is running. NO-MACHINES will remove all machines. DINT will turn off all interrupts. For a full cleanout of code from reset, use the sequence:

DINT FORGET word
' ISOMAXBETA BOOTUP
[RESET]

TWE