Thread: [Flashforth-devel] Warnings from assembler
Brought to you by:
oh2aun
From: Helge K. <Hel...@gm...> - 2022-12-28 08:34:02
|
Hello I am trying to evaulate a Forth for my ATmega2560. I want to work interactively but also want to able to build the turnkey with the assembler. Therefore I started with rebuilding Flashforth. I use avrasm2 version 2.2.8 as it comes with Microchip Studio 7.0. I changed the build script that it also finds the include file m256def.inc. The resulting command to compile Flashfort is: "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avrassembler\avrasm2.exe"-I "C:\Program Files (x86)\Atmel\Studio\7.0\packs\atmel\ATmega_DFP\1.6.364\avrasm\inc" -Dffm2560 -Dop0 -I asm2/include/ avr/src/ff-atmega.asm -o avr/hex/2560-16MHz-38400.hex -fI The generated HEX file is identical to the HEX file in the repository. That's great. Buit I get some compiler diagnostic messages: avr/src/macros.inc(39): warning: Register r26 already defined by the .DEF directive avr/src/ff-atmega.asm(35): info: 'avr/src/macros.inc' included from here The source code line macros.inc#39 defines the symbold t4: .def t4 = r26 (The "already defined" warning also occurs for the registers r27, r30, and r31. ) Why does the assmbler complains about r26 as already defined? Where is it defined elsewehere? I can't find a second #include statement that would cause the file macros.inc included twice. Did I miss something? There is also a warning about "Use of undefined or forward referenced symbol". But that's just a forward reference. It would be nice to suppress that warning. But it looks that the assembler isn't that decent to disable specific warnings. Best reagards, Helge |
From: Mikael N. <mik...@fl...> - 2022-12-28 09:34:56
|
Those registers are defined by avrasm2 to be xl, xh, zl, zh Thats why it complains. I have moved to XC8. It does not complain about what you have mentioned. BR Mikael On 2022-12-28 10:33, Helge Kruse wrote: > I get some compiler diagnostic messages: > > avr/src/macros.inc(39): warning: Register r26 already defined by the > .DEF directive > avr/src/ff-atmega.asm(35): info: 'avr/src/macros.inc' included from > here > > The source code line macros.inc#39 defines the symbold t4: > > .def t4 = r26 > > (The "already defined" warning also occurs for the registers r27, r30, > and r31. ) Why does the assmbler complains about r26 as already > defined? > Where is it defined elsewehere? I can't find a second #include > statement > that would cause the file macros.inc included twice. Did I miss > something? > > There is also a warning about "Use of undefined or forward referenced > symbol". |
From: Helge K. <Hel...@gm...> - 2022-12-28 14:27:24
|
Hi Mikael, I have pulled the latest commit 73aba62 from November 11th. This includes HEX files for the AVR targets. I expected that the same sequence of avrdude commands should prepare my Arduino with a running system. avrdude -cusbasp -pm2560 -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xD8:m -Ulfuese:w:0xFF:m avrdude -cusbasp -pm2560 -Uflash:w:2560-16MHz-38400.hex:i -Uhfuse:w:0xD8:m With the version from commit c947663 (2022-04-26) I get the output in the terminal: E FlashForth 5 ATmega2560 18.11.2020 Is my expectation invalid to get a similar output with the latest HEX file? I don't see any output with the latest files. Can you recommend how to bring the current version to the Arduino 256 target? Best regards, Helge This sequence works with the files f Am 28.12.2022 um 10:34 schrieb Mikael Nordman: > Those registers are defined by avrasm2 to be xl, xh, zl, zh > Thats why it complains. > > I have moved to XC8. It does not complain about what you have mentioned. > > BR Mikael > > On 2022-12-28 10:33, Helge Kruse wrote: >> I get some compiler diagnostic messages: >> >> avr/src/macros.inc(39): warning: Register r26 already defined by the >> .DEF directive >> avr/src/ff-atmega.asm(35): info: 'avr/src/macros.inc' included from here >> >> The source code line macros.inc#39 defines the symbold t4: >> >> .def t4 = r26 >> >> (The "already defined" warning also occurs for the registers r27, r30, >> and r31. ) Why does the assmbler complains about r26 as already defined? >> Where is it defined elsewehere? I can't find a second #include statement >> that would cause the file macros.inc included twice. Did I miss >> something? >> >> There is also a warning about "Use of undefined or forward referenced >> symbol". > > > _______________________________________________ > Flashforth-devel mailing list > Fla...@li... > https://lists.sourceforge.net/lists/listinfo/flashforth-devel |
From: Mikael N. <mik...@fl...> - 2022-12-28 19:06:10
|
Hi Helge, Check here for the up to date instructions. https://flashforth.com/atmega.html BR Mikael On 2022-12-28 16:27, Helge Kruse wrote: > Can you recommend how to bring the current version to the Arduino 256 > target? |
From: Helge K. <Hel...@gm...> - 2023-01-01 10:44:14
|
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 On 28.12.2022 20:05, Mikael Nordman wrote: > Hi Helge, > > Check here for the up to date instructions. > https://flashforth.com/atmega.html > > BR Mikael > > On 2022-12-28 16:27, Helge Kruse wrote: >> Can you recommend how to bring the current version to the Arduino 256 >> target? > > > _______________________________________________ > Flashforth-devel mailing list > Fla...@li... > https://lists.sourceforge.net/lists/listinfo/flashforth-devel |
From: Mikael N. <mik...@fl...> - 2023-01-04 19:46:19
|
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 > |
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 |
From: Mikael N. <mik...@fl...> - 2023-01-08 07:20:52
|
Some thoughts. What is your output from avrdude -v -v ? What is the md5 checksum of the hex file ? Mine is md5sum 2560-16MHz-38400.hex b196d7b782bc26ee11d26cb03a60f1ea Once upon a time there was some ISP hardware (or avrdude version ?) that could not handle properly a hex file where the first part is in the lower 128 Kbytes and the second part is in the higher 128 Kbytes of flash. .s is executed by prompt and if there is something on the stack and .s fails for some unknown reason with a restart. Can ' busy is prompt be executed ? It would set the prompt to do (almost) nothing. BR Mikael On 2023-01-07 14:01, Helge Kruse wrote: > 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: > Currently I have no idea what's going on here. > > Hest regards, > Helge |
From: Peter H. <p.h...@we...> - 2023-01-08 10:02:55
|
Hallo, es könnte durchaus an einer ungünstigen Version von avrdude.exe/-conf liegen. Ich verwende eine ältere Version aus 2014 und benutze ARDUINO-ISP (UNO/Nano als Programmer). - *avrdude.conf 13.03.2014* - *avrdude.exe 13.07.2014* welche problemlos auch den Mega sauber programmiert. Kann mich erinnern, daß ich auf der Suche nach einer mögl. kleinen avrdude.e (die conf habe ich abgespeckt auf 37 kB) auch t.w. "Irritationen oder auch Leseschwierigkeiten" beim Programmieren hatte. Also einfach mal verschiedene Versionen vom avrdude "checken/probieren" --> es geht nix kaputt. Peter Am 08.01.2023 um 08:20 schrieb Mikael Nordman: > Some thoughts. > > What is your output from avrdude -v -v ? > > What is the md5 checksum of the hex file ? > Mine is > md5sum 2560-16MHz-38400.hex b196d7b782bc26ee11d26cb03a60f1ea > > Once upon a time there was some ISP hardware (or avrdude version ?) > that could not handle properly a hex file where the first part is in the > lower 128 Kbytes and the second part is in the higher 128 Kbytes of > flash. > > .s is executed by prompt and if there is something on the stack > and .s fails for some unknown reason with a restart. > > Can ' busy is prompt be executed ? > It would set the prompt to do (almost) nothing. > > BR Mikael > > On 2023-01-07 14:01, Helge Kruse wrote: > >> 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: >> Currently I have no idea what's going on here. >> >> Hest regards, >> Helge > > > _______________________________________________ > Flashforth-devel mailing list > Fla...@li... > https://lists.sourceforge.net/lists/listinfo/flashforth-devel |
From: Helge K. <Hel...@gm...> - 2023-01-12 17:00:36
|
On 08.01.2023 08:20, Mikael Nordman wrote: > Some thoughts. > > What is your output from avrdude -v -v ? $ avrdude -v -v avrdude: Version 7.0 Copyright (c) Brian Dean, http://www.bdmicro.com/ Copyright (c) Joerg Wunsch System wide configuration file is "C:/Users/Helge/Bin/avrdude.conf" avrdude: no programmer has been specified on the command line or the config file Specify a programmer using the -c option and try again > What is the md5 checksum of the hex file ? $ md5 2560-16MHz-38400.hex b196d7b782bc26ee11d26cb03a60f1ea (25,178) > Mine is > md5sum 2560-16MHz-38400.hex b196d7b782bc26ee11d26cb03a60f1ea Looks as it is identical. I wouldn't expect anything else since I got the file using git from github. > Once upon a time there was some ISP hardware (or avrdude version ?) > that could not handle properly a hex file where the first part is in the > lower 128 Kbytes and the second part is in the higher 128 Kbytes of flash. I connected a (Salea compatible) logic analyzer and recorded the traffic at the ISP interface. The sigrok decoder outputs shows each byte in a textual representation. I am currently converting this output to hex file. I hope I can check what is going on on the ISP interface. Best regards, Helge |