Re: [Flashforth-devel] FlashForth on the ATmega2560
Brought to you by:
oh2aun
From: Helge K. <Hel...@gm...> - 2023-01-07 12:01:15
|
Hello Mikael, The surprise is also at my side. I used avrdude to verify what is the memories. The steps with binary read and srec_cat creates a hex file with the same line length as the original file: avrdude -pm2560 -cusbasp -U flash:r:curr-flash.bin:r -U eeprom:r:curr-eeprom.bin:r srec_cat curr-flash.bin -binary -unfill 0xFF 16 -o curr-flash.hex -Intel -line-length=44 srec_cat curr-eeprom.bin -binary -unfill 0xFF 16 -o curr-eeprom.hex -Intel -line-length=44 I could see that the avrdude option -e did not guarantee that the EEPROM content is erased. I added a block to erase it: -U eeprom:w:0xFF:m I read back flash memory, EEPROM, and all fuses. Everything looks correct now. Except that FlashForth restarts under some conditions. These words give the expected result: words swap dnegate .s cr idle decimal hex If I enter a number or any word that should leave a number on the stack, FlashForth restarts. BTW: Usually the reset reason is printed with a character code before the welcome line. This is not the case here: E FlashForth 5 ATmega2560 19.11.2022 words p2+ pad pc@ @p ddrb portb hi unused d. ud. d> d< d= d0< d0= dinvert d2* d2/ d- d+ dabs ?dnegate dnegate s>d rdrop endit next for in, inline repeat while again until begin then else if zfl pfl xa> >xa x>r dump .s words >pr .id ms ticks r0 s0 latest state bl 2- ['] -@ ; :noname : ] [ does> postpone create cr [char] ihere ( char ' lit abort" ?abort ?abort? abort prompt quit true false .st inlined immediate shb interpret 'source >in tiu tib ti# number? >number ud/mod ud* sign? digit? find immed? (f) c>n n>c @+ c@+ place cmove word parse \ /string source user base hb hp task ulink rsave bin hex decimal . u.r u. sign #> #s # digit <# hold up min max ?negate tuck nip / u*/mod u/ * u/mod um/mod um* 'key? 'key 'emit p++ p+ pc! p! p@ r>p !p>r !p u> u< > < = 0< 0= <> within +! 2/ 2* >body 2+ 1- 1+ negate invert xor or and - m+ + abs dup r@ r> >r rot over swap drop allot ." ," s" (s" type accept 1 umax umin spaces space 2over 2swap 2dup 2drop 2! 2@ cf, chars char+ cells cell+ aligned align cell c, , here dp ram eeprom flash >< rp@ sp! sp@ 2constant constant 2variable variable @ex execute key? key emit Fcy mtst scan skip n= rshift lshift mclr mset ic, i, operator iflush cwd wd- wd+ pause turnkey to is defer value fl+ fl- c! c@ @ x! x@ a> ! >a literal int! ;i di ei ver warm empty rx1? rx1 tx1 rx0? rx0 tx0 load- load+ busy idle exit marker ok<#,ram> swap ok<#,ram> dnegate ok<#,ram> .s ok<#,ram> idle ok<#,ram> decimal hex ok<$,ram> 0 FlashForth 5 ATmega2560 19.11.2022 true ok<#,ram> FlashForth 5 ATmega2560 19.11.2022 false ok<#,ram> FlashForth 5 ATmega2560 19.11.2022 12345 FlashForth 5 ATmega2560 19.11.2022 variable FOO FlashForth 5 ATmega2560 19.11.2022 dup ok<#,ram> FlashForth 5 ATmega2560 19.11.2022 empty ok<#,ram> true ok<#,ram> FlashForth 5 ATmega2560 19.11.2022 Currently I have no idea what's going on here. Hest regards, Helge On 04.01.2023 20:46, Mikael Nordman wrote: > That is surprising. > On my Arduino Mega2560 board everything works just fine. > > I am using exactly the same avrdude command except for stk500 instead > of usbasp. > > Try executing 'empty' as first command. That may help. > > Altough the -e chip erase directive should have the same effect as > executing 'empty' as the first command. > > BR Mikael > > On 2023-01-01 12:43, Helge Kruse wrote: >> Happy New Year to all Forth enthusiasts! >> >> >> Probably the website could be extended with commands for the board other >> than Arduino UNO. I managed to flash FF to my ATMEGA2560 board using >> this command: >> avrdude -v -patmega2560 -c usbasp -e -Ulock:w:0x3F:m -Uefuse:w:0xff:m >> -Uhfuse:w:0xdf:m -Ulfuse:w:0xff:m -U flash:w:2560-16MHz-38400.hex >> >> Now I can play with the stack. But defining a new word causes a warm >> boot: >> >> variable foo FlashForth 5 ATmega2560 19.11.2022 >> : bar ; FlashForth 5 ATmega2560 19.11.2022 >> create magic FlashForth 5 ATmega2560 19.11.2022 >> >> This was working on a Arduino UNO before. Is there anything other I have >> to prepare to run FlashForth on ATmega2560? >> >> Best regards, >> Helge >> > > > _______________________________________________ > Flashforth-devel mailing list > Fla...@li... > https://lists.sourceforge.net/lists/listinfo/flashforth-devel |