Re: [Amforth] successful compilation with avra

2023-08-25 Thread George Herzog
Thanks for your efforts.

People don't often appreciate how much knowledge and effort goes into
successful compilation of code.



On Fri, Aug 25, 2023, 3:15 PM Erich Wälde  wrote:

> Hello Brian and Mark,
>
> very nice to see emails on this list :)
>
> Compiling amforth with avra?
>
> I have made numerous experiments a long time ago and again more
> recently. If memory serves me well:
> - Amforth had been good with avra, at least in the 4.x range.
> - However, avrasm2.exe could do more clever tricks, and Matthias
> started using those.
> - I did make a fork of amForth from Version 5.0, this can be
> assembled with avra, see:
> https://git.sr.ht/~ew/hbv3_am50forth
> - avra received a bit of attention not so long ago (same repo
> you found):
> https://github.com/Ro5bert/avra
> > $ avra --version
> > AVRA: advanced AVR macro assembler (version 1.4.2)
> which among other changes now includes my favourite atmega644p.
>
> So, I am currently dabbling with my fork again in the hope to
> eventually catch that problem of long term stability. There is
> absolutely no reason, why I have to reprogram one or two of my
> controllers a few times per year, because they do not start up
> after a power cycle, which in turn is done, because the
> communication with that controller ceases to work. I went back
> to amforth 5.0 for simplicity reasons.
>
>
> All that being said, I would be very interested to see the
> changes, maybe, just maybe we can fix the amForth source tree
> enough to make avra happy.
>
>
> Cheers,
> Erich
>
> Brian K Navarette  writes:
>
> > That is awesome news!
> > Brian-in-ohio
> >
> >
> > On Thu, Aug 24, 2023 at 2:59 PM Mark Roth  wrote:
> >
> >> Hello AmForth. It has been some time and quite weird things since last
> I've
> >> been here. I am still using AmForth with my trusty atmega1284p and
> learning
> >> the language as time permits. I remember having heard talk that avra had
> >> gotten (almost) to the point of being able to compile the source tree
> here.
> >> First I tried with 1.3 I think and it failed miserably. Then I found a
> repo
> >> on github (Ro5bert/avra) that seemed to almost but not quite do it. I
> was
> >> getting a pile of errors for macro calls. So looking into the issues I
> saw
> >> that someone had forked that repo and fixed the issue. Something to do
> with
> >> not having a space between the opening parenthesis and the macro name.
> So I
> >> tracked down the fix branch (srtlg/avra -b development-issue54 if I
> >> remember correctly) and built that locally. Then substituted that avra
> >> version with the wine one I had been using to build.
> >> It still didn't build. Very almost, but not quite.
> >> However, the issue was with errors in /avr8/words/d-lesszero.asm about
> the
> >> Y register not being declared and/or able to be used for the adiw call.
> >> Looking into the source tree I found other usages of y in those calls
> but
> >> they were all in lower case.
> >> Yeah, that did fix it. I'm not sure that I can flash my controller here
> >> since I'm on summer break but it does seem promising. Or maybe I did
> pack
> >> my programmer and can give it a go. The file sizes are the same or
> similar
> >> but there are differences. Granted, I've made changes that may not be
> >> represented in my working project and it may just be that.
> >> Time will tell but it would be great to get rid of the need to use wine
> to
> >> build AmForth here.
> >> Well well well. It appears to have worked. I make install'd the whole
> thing
> >> (since for some reason I did pack my usbasp and could try it out. I'm
> sure
> >> more testing is needed but this really is pretty cool.
> >>
> >> ___
> >> Amforth-devel mailing list for http://amforth.sf.net/
> >> Amforth-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/amforth-devel
> >>
> >
> > ___
> > Amforth-devel mailing list for http://amforth.sf.net/
> > Amforth-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/amforth-devel
>
>
> --
> May the Forth be with you ...
>
>
> ___
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>

___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


Re: [Amforth] AmForth Project open for adoption

2022-05-07 Thread George Herzog
Thanks  for your efforts.

On Fri, May 6, 2022, 3:37 PM Erich Wälde  wrote:

>
> Dear AmForthers,
>
> I am herewith stepping down from the maintainer role of AmForth. For
> details,
> read on. If anyone is interested to take over, get in touch with me.
>
>
> In 2020 I received the logins of amforth.sourceforge.net, basically
> because I
> was lucky enough to have met Matthias personally a few times. At that time
> I
> had a lot of ideas on how to proceed. And while I managed to create an
> official release, there are a few obstacles in this path.
>
> First and foremost I am facing a health issue. It is subtle, but it
> seriously limits, what I can do. I still have to make several difficult
> decisions regarding my daily life. I have started to decrease the number of
> things on my list by cancelling items. I have to accept the fact, that I'm
> not
> in a position any more to advance the AmForth project in a meaningful way.
>
> Secondly, AmForth has become complex over time. Matthias added support for
> three more target platforms (msp430, arm, riscv32). Allthough access to
> these
> is easily achievable, I use only avr. And I use it less these days.
>
> Thirdly, AmForths tools are depending heavily on python code, a language I
> consider myself illiterate in. I have written a few small perl scripts
> around
> AmForth to serve my needs. I heavily depend on those and on a Makefile.
>
> Add the fact, that in 2020 I spent countless hours to port my data
> acquisition
> stuff at home from amforth 4.6 to 6.9 and it just did not become stable. To
> this day I still have no clue, why the thing hangs itself after some time,
> sometimes hours, sometimes several days. In other words: unusable.
>
>
> Step back: what would I have done, if I didn't know Matthias, and the
> project
> would just have become silent? Simplify. Simplify heavily.
>
> Very recently I have made a fork of AmForth release 5.0. That version is
> before support for msp430 was officially added (5.5). That version happens
> to
> compile with avra rather than wine/avrasm2.exe. Along the way I found, that
> avra has seen new releases, which add support for my beloved atmega644p and
> lots of fixes, which is nice! This removes the dependancy from wine and
> allows
> for smaller systems for development.
>
> So I have picked up my data acquisition project again with the fork
> mentioned
> above. Any Interrupt Service Routines are written in assembly to avoid the
> thing that I uncovered in 2017, namely a race condition 1 bit wide and 1
> instruction cycle long. I pick missing bits and pieces from later
> releases. I
> would like to add a few features regarding sensors with different needs. A
> first experiment has run more than 10^6s (12d) without any failure. So I am
> moderately optimistic to continue along this simplified path.
>
>
> Thanks to all, who have answered the list, contributed code, ideas,
> documentation in one form or other. It has been an interesting experience.
> And should you still care to listen: if you have one or a few more
> important
> plans, do not delay them, you might be unable to pursue them later.
>
> Happy hacking, and use the Forth!
>
> Cheers
> Erich
>
> --
> May the Forth be with you ...
>
> ___
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>

___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


Re: [Amforth] AmForth 6.9 on Arduino MEGA using ATmega2560- No reponse at console

2022-04-17 Thread George Herzog
The big advantage with the Arduino Mega is lots of 8 bit ports available
for parrallel i/o.  The Arduino Uno pretty much forces all i/o to be
serialized one way or another.

On Sun, Apr 17, 2022 at 3:33 PM Martin Nicholas via Amforth-devel <
amforth-devel@lists.sourceforge.net> wrote:

> On Sun, 17 Apr 2022 07:47:15 +0100
> Tristan Williams  wrote:
>
> > Hi Christian,
> >
> > Glad it worked.
> >
> > > How much of 256KB flash is effectively usable with AmForth on the
> > > 2560? ?
> >
>
> 64k only (which is heaps) - W and IP are 16-bits only. The upper 64k is
> still available, a little bit is used for the flashing code. I use
> some of this space for user messages.
>
> > Good question. I don't know. The file avr8/words/store-i_big.asm may
> > give some clues.
> >
> > > Will this work as well on a Chinese  ATmega2560ProMini (with FTDI
> > > USB chip for terminal input) ?
> >
> > Again, I don't know. However, if the board has an ATmega2560 mcu
> > running at 16 MHz then there is good chance. I think only by flashing
> > the board and testing it will you have a better idea.
> >
>
> The clones work fine. Out of the box you might have to blow the fuses
> first - before flashing the memory.
>
> --
> Regards,
>
> Martin Nicholas.
>
> E-mail: reply-2...@mgn.org.uk (Address will be valid throughout 2022).
>
>
> ___
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>

___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


Re: [Amforth] AmForth 6.9 on Arduino MEGA using ATmega2560- No reponse at console

2022-04-17 Thread George Herzog
Hello,
I  believe only 50% of the Arduino Mega flash is available to Forth for
dictionary use.

This is simply a hardware barrier that exists. The additional 126kb
theoretically can be put to use in other ways, but I've not seem actually
solutions.
On Sun, Apr 17, 2022, 2:48 PM Tristan Williams  wrote:

> Hi Christian,
>
> Glad it worked.
>
> > How much of 256KB flash is effectively usable with AmForth on the 2560? ?
>
> Good question. I don't know. The file avr8/words/store-i_big.asm may give
> some
> clues.
>
> > Will this work as well on a Chinese  ATmega2560ProMini (with FTDI USB
> chip for terminal input) ?
>
> Again, I don't know. However, if the board has an ATmega2560 mcu
> running at 16 MHz then there is good chance. I think only by flashing
> the board and testing it will you have a better idea.
>
> > If so, may I share your links with a friend who has an
> ATmega2560ProMini?
>
> Yes.
>
> Kind regards,
>
> Tristan
>
> On 16Apr22 16:34, Christian Hinse wrote:
> > Hi Tristan.
> >
> > Your r2457AmForth  version is working fine on my Arduino MEGA with
> ATmega2560, except for a few garbled character after the reset. But that is
> probably normal. It occurs on the UNO as well.
> >
> > > amforth 7.0 ATmega2560 16000 kHz
> > > words
> > int-trap int@ int! -int +int #int irq[]# postpone (marker) end-code
> code forth-wordlist wordlist set-current >body s>d bounds init-ram ee>ram
> #tib tib source-tib refill-tib 2swap cmove dnegate dabs j * icompare
> nfa>cfa name>string traverse-wordlist search-wordlist (defer) defer@
> defer! Udefer! Udefer@ Rdefer! Rdefer@ Edefer! Edefer@ i-cell+ to unused
> noop ver ?stack rectype-null rectype-xt rec-find rec-num rectype-dnum
> rectype-num recognize forth-recognizer interpret depth rp0 sp0 warm cold
> pause quit .input .error .ready .ok find-xt parse-name /string source parse
> >number number char refill accept cscan cskip throw catch handler ' type
> spaces space cr icount itype s, digit? ud/mod ud.r ud. . d. .r d.r sign #>
> #s # <# hold hld tolower toupper within max min abs mod / negate u/mod /mod
> turnkey bl hex decimal bin allot here ehere dp key? key emit? emit pad >in
> tuck 2drop 2dup cell+ cells base state f_cpu environment fill s" ." pick
> words show-wordlist u.r u. dinvert d- d+ d2/ d2* nr> n>r -1 2 1 = 2literal
> @i (i!) !i @e !e 2r> 2>r up! up@ >< cmove> unloop i sp! sp@ rp! rp@ +!
> rshift lshift ?negate 1- 1+ xor or and 2* 2/ invert um* um/mod m* + - log2
> > < u> u< 0 true d0< d0> 0> 0< 0= <> r@ >r r> nip rot drop over swap ?dup
> dup !u @u c@ c! ! @ (value) execute exit applturnkey nfa>lfa compare
> cfg-recs cfg-order get-current map-stack set-stack get-stack ?abort abort
> abort" [char] immediate recurse user constant variable [ ] ; :noname :
> does> reveal wlscope header create lp lp0 >l l> endloop ?do leave +loop
> loop do again until repeat while begin then else if ahead sliteral literal
> ['] , compile ( \ (create-in) (create) latest newest 1ms name>flags umin
> umax ud* m+ sleep !wdc wdr c!@spi bm-toggle bm-clear bm-set b> >b b!- b!+
> nb! b! b@- b@+ nb@ b@ a> >a a!- a!+ na! a! a@- a@+ na@ a@ +usart ubrr
> tx?-poll tx-poll rx?-buf rx-buf isr-rx >rx-buf  ok
> > >
> >
> > Some question:
> >
> >   *   How much of 256KB flash is effectively usable with AmForth on the
> 2560?
> >   *   Will this work as well on a Chinese  ATmega2560ProMini (with FTDI
> USB chip for terminal input) ?
> >   *   If so, may I share your links with a friend who has an
> ATmega2560ProMini?
> >
> > Thanks a lot for your help.
> >
> > Christian Hinse
> > 
> > From: Tristan Williams 
> > Sent: 16 April 2022 06:05
> > To: amforth-devel@lists.sourceforge.net <
> amforth-devel@lists.sourceforge.net>
> > Subject: Re: [Amforth] AmForth 6.9 on Arduino MEGA using ATmega2560- No
> reponse at console
> >
> > Hello Christian,
> >
> > Below is a link to AmForth hex files I built for my Arduino MEGA using
> the
> > (then) most recent source (r2457). The console baud rate is 38400 and
> > build details are in the atmega2560.asm file.
> >
> > https://tjnw.co.uk/amforth-bin/
> >
> > Some background info is contained in this message thread.
> >
> > https://sourceforge.net/p/amforth/mailman/message/37296323/
> >
> > Hope this helps and let me know if you get it up and running.
> >
> > Kind regards,
> >
> > Tristan
> >
> > On 16Apr22 07:08, Christian Hinse wrote:
> > > Hi to your support team.
> > >
> > > I have AmForth working properly on an Arduino UNO.
> > >
> > > I am now trying to use it with an Arduino MEGA using the Atmega2560
> but I get no console response after programming the files  atmega256.hex
> and atmega256.eep.hex from folder \amforth-6.9\appl\atmega2561 of
> downloaded file amforth-6.9.zip.
> > >
> > > I still consider myself as a beginner hobbyist and  I do not yet have
> the ability to assemble my one code from source.
> > >
> > >   *   Are these Hex file effectively compatible with the Arduino MEGA
> using the ATmega2560 ?
> > >   *   

Re: [Amforth] Building amForth with Microchip Studio 7

2021-09-08 Thread George Herzog
typo correction - " If you don't *know if* your ATmega2560 binaries are
correctly compiled, AmForth does have precompiled ready to load ATmega328p
binaries that you can load to an ArduinoUNO as a way of learning to
understand AVRDUDE and proper FUSE settings."

On Wed, Sep 8, 2021 at 2:15 PM George Herzog 
wrote:

> Hi Helen,
> I strongly advise you to* avoid *use of Atmel Studio or the Microchip
> successor.
>
> Using the standalone Atmel assembler in Windows is a much easier solution
> to control. The Microsoft VisualStudio software bogs down and has a very
> challenging learning curve with getting good results.
>
> *It sounds as though you successfully compiled binaries in hex files, but
> you may very likely hit a snag in AVRDUDE. *
>
> It is very common when installing Forth to deploy the wrong fuse setting
> and end up with no serial port response. So you might consider using an
> online Atmel Fuse calculator to confirm your fuse settings.
>
> HERE IS A LINK ==> https://www.engbedded.com/fusecalc/
>
> THERE ARE OTHERS IF THIS ONE DOESN'T APPEAL TO YOU.
>
> +
> Also, make sure that you understand what the AVRDUDE output is saying.
> There are 3 separate parts to a successful download.  The .hex file for the
> flash, the .hex file for the eeprom, and the FUSE settings.
>
> If you don't your ATmega2560 binaries are correctly compiled, AmForth does
> have precompiled ready to load ATmega328p binaries that you can load to an
> ArduinoUNO as a way of learning to understand AVRDUDE and proper FUSE
> settings.
>
> I hope this will help.
> George Herzog
>
>
>
> On Wed, Sep 8, 2021 at 3:33 AM Helge Kruse  wrote:
>
>> I am a newby to amForth. I want to use it at ATmega 2560. For the first
>> steps I want to use the more common board Arduino UNO.
>>
>> I flashed the files uno.hex and uno.eep.hex from the directory
>> amforth-6.9\appl\arduino to my Arduino UNO. This gives me a greeting
>>
>> amforth 6.9 ATmega328P Forthduino
>>  >
>>
>> I think, the mega328p fuses and the USB/serial connection are verified.
>> Now I want to build the amForth from the sources. The documentation at
>> http://amforth.sourceforge.net/UG/quick-windows.html is a bit dated (for
>> amForth 6.6). The Atmel studio is not available anymore. I found only
>> the Microchip Studio 7 as the successor of the Atmel studio at the
>> Microchip website. (Atmel has been purchased by Microchip.)
>>
>> I set up a main.asm file as
>>
>>  .include "preamble.inc"
>>  .equ F_CPU = 1600
>>  .include "drivers/usart.asm"
>>  .include "amforth.asm"
>>
>> and configured the include directories:
>> $(PackRepoDir)\atmel\ATmega_DFP\1.6.364\avrasm\inc
>> amforth-6.9\avr8
>> amforth-6.9\avr8\devices\atmega328p
>> amforth-6.9\appl\arduino
>> amforth-6.9\common
>> Without these directories some .asm files had not been found. The
>> Microchip Studio 7 compiles without errors:
>>
>> avrasm2.exe -fI -o my.hex -e my.eep -S my.tmp -W+ie -I"D:/Program Files
>> (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\avrasm\inc"
>> -I"amforth-6.9\avr8" -I"amforth-6.9\avr8\devices\atmega32"
>> -I"amforth-6.9\appl\arduino" -I"amforth-6.9\common" -im32def.inc -d
>> "Debug\myprog_m32.obj" "main.asm" -I "D:\Program Files
>> (x86)\Atmel\Studio\7.0\toolchain\avr8\avrassembler\Include"
>>
>>
>> Segment   BeginEnd  Code   Data   UsedSize   Use%
>> -
>> [.cseg] 0x00 0x007f82   1838  11508  13346   32768  40.7%
>> [.dseg] 0x60 0x00011f  01911912048   9.3%
>> [.eseg] 0x00 0x86  01341341024  13.1%
>> Assembly complete, 0 errors. 8 warnings
>>
>> I can also provide the complete assembler stdout stream. But I hesitate
>> to send such a large mail to the list without request.
>>
>> But after flashing my.hex and my.eep to the Arduino UNO I can see
>> nothing. Therefore I assume something's wrong with my build.
>>
>> Can somebody provide an minimum example for a basic amForth project with
>> the Microchip Studio 7?
>> Is there any updated documentation for the build process that handles
>> the Studio 7 environment?
>> Any hints how I find and remove the problem?
>>
>> I hope this can be easily solved. I've seen in the mailing list archive
>> that a build with mega2560 was successful lately.
>>
>> Best regards,
>> Helge
>>
>>
>> ___
>> Amforth-devel mailing list for http://amforth.sf.net/
>> Amforth-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>>
>

___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


Re: [Amforth] Building amForth with Microchip Studio 7

2021-09-08 Thread George Herzog
Hi Helen,
I strongly advise you to* avoid *use of Atmel Studio or the Microchip
successor.

Using the standalone Atmel assembler in Windows is a much easier solution
to control. The Microsoft VisualStudio software bogs down and has a very
challenging learning curve with getting good results.

*It sounds as though you successfully compiled binaries in hex files, but
you may very likely hit a snag in AVRDUDE. *

It is very common when installing Forth to deploy the wrong fuse setting
and end up with no serial port response. So you might consider using an
online Atmel Fuse calculator to confirm your fuse settings.

HERE IS A LINK ==> https://www.engbedded.com/fusecalc/

THERE ARE OTHERS IF THIS ONE DOESN'T APPEAL TO YOU.

+
Also, make sure that you understand what the AVRDUDE output is saying.
There are 3 separate parts to a successful download.  The .hex file for the
flash, the .hex file for the eeprom, and the FUSE settings.

If you don't your ATmega2560 binaries are correctly compiled, AmForth does
have precompiled ready to load ATmega328p binaries that you can load to an
ArduinoUNO as a way of learning to understand AVRDUDE and proper FUSE
settings.

I hope this will help.
George Herzog



On Wed, Sep 8, 2021 at 3:33 AM Helge Kruse  wrote:

> I am a newby to amForth. I want to use it at ATmega 2560. For the first
> steps I want to use the more common board Arduino UNO.
>
> I flashed the files uno.hex and uno.eep.hex from the directory
> amforth-6.9\appl\arduino to my Arduino UNO. This gives me a greeting
>
> amforth 6.9 ATmega328P Forthduino
>  >
>
> I think, the mega328p fuses and the USB/serial connection are verified.
> Now I want to build the amForth from the sources. The documentation at
> http://amforth.sourceforge.net/UG/quick-windows.html is a bit dated (for
> amForth 6.6). The Atmel studio is not available anymore. I found only
> the Microchip Studio 7 as the successor of the Atmel studio at the
> Microchip website. (Atmel has been purchased by Microchip.)
>
> I set up a main.asm file as
>
>  .include "preamble.inc"
>  .equ F_CPU = 1600
>  .include "drivers/usart.asm"
>  .include "amforth.asm"
>
> and configured the include directories:
> $(PackRepoDir)\atmel\ATmega_DFP\1.6.364\avrasm\inc
> amforth-6.9\avr8
> amforth-6.9\avr8\devices\atmega328p
> amforth-6.9\appl\arduino
> amforth-6.9\common
> Without these directories some .asm files had not been found. The
> Microchip Studio 7 compiles without errors:
>
> avrasm2.exe -fI -o my.hex -e my.eep -S my.tmp -W+ie -I"D:/Program Files
> (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\avrasm\inc"
> -I"amforth-6.9\avr8" -I"amforth-6.9\avr8\devices\atmega32"
> -I"amforth-6.9\appl\arduino" -I"amforth-6.9\common" -im32def.inc -d
> "Debug\myprog_m32.obj" "main.asm" -I "D:\Program Files
> (x86)\Atmel\Studio\7.0\toolchain\avr8\avrassembler\Include"
>
>
> Segment   BeginEnd  Code   Data   UsedSize   Use%
> -
> [.cseg] 0x00 0x007f82   1838  11508  13346   32768  40.7%
> [.dseg] 0x60 0x00011f  01911912048   9.3%
> [.eseg] 0x00 0x86  01341341024  13.1%
> Assembly complete, 0 errors. 8 warnings
>
> I can also provide the complete assembler stdout stream. But I hesitate
> to send such a large mail to the list without request.
>
> But after flashing my.hex and my.eep to the Arduino UNO I can see
> nothing. Therefore I assume something's wrong with my build.
>
> Can somebody provide an minimum example for a basic amForth project with
> the Microchip Studio 7?
> Is there any updated documentation for the build process that handles
> the Studio 7 environment?
> Any hints how I find and remove the problem?
>
> I hope this can be easily solved. I've seen in the mailing list archive
> that a build with mega2560 was successful lately.
>
> Best regards,
> Helge
>
>
> ___
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>

___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


Re: [Amforth] Compiling for a headless target

2021-08-31 Thread George Herzog
Martin Nichols has offered the simplest solution.

On Tue, Aug 31, 2021 at 5:03 PM Martin Nicholas via Amforth-devel <
amforth-devel@lists.sourceforge.net> wrote:

> On Tue, 31 Aug 2021 06:27:50 +0200
> Helge Kruse  wrote:
>
> > Hello, I am new to amForth.
> >
> > amForth is an interactive Forth. The compiler runs on the target and
> > writes to the flash memory of the device. This requires to send all
> > the source code through the UART interface.
> >
> > I want to develop a Forth application for a target that uses the
> > ATmeage256 USART for the application data. In that case it would be
> > desired to compile the application, create a hex file and use USBasp
> > to flash it to the target.
> >
> > How can I compile the Forth words, probably with the AVR assembler,
> > for a target without a free UART? Is there any idea of a cross
> > compiler or generating of assembler source code that could be place
> > in a file lilke appltrunkey.asm.
> >
> > Are there other ways to approach?
> >
> > Best regards,
> > Helge
> >
> >
> >
> > ___
> > Amforth-devel mailing list for http://amforth.sf.net/
> > Amforth-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/amforth-devel
> >
> >
>
> ATmegas have at least two USARTs, I'd use one of them for your extra
> interface. The advantages of Forth's interactivity is lost if you can
> no longer interact with it via the terminal - you might as well write
> in C.
>
> --
> Regards,
>
> Martin Nicholas.
>
> E-mail: reply-2...@mgn.org.uk (Address will be valid throughout 2021).
>
>
> ___
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>

___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


Re: [Amforth] Newbie with a mega2560

2021-05-22 Thread George Herzog
There are AmForth error codes. Read up on them.

On Sun, May 23, 2021, 12:42 Michael Picco  wrote:

> Hello!
>
> I seem to have stumbled across an issue.
>
> First code I wrote was to blink the LED onboard.  This worked just fine.
> Then I went to add 'marker'.  Entered it line-by-line ... got the 'Ok'
> after each line.  After adding the last line (semicolon), the board
> froze up.  Did a warm boot and then executed 'words' to see what was
> there.  It came back with ?? -13 5.
>
> What came to mind is perhaps not enough memory is allocated prior to
> flashing and I'm overwriting something I shouldn't.
>
> Any ideas?
>
> Kind regards,
>
> Michael
>
> On 5/21/2021 1:28 AM, tristan wrote:
> > Hi Michael,
> >
> > Apologies. My memory is failing me.
> >
> > The LED is on D13 for both UNO and MEGA, but D13 is mapped to PB5
> > (PORTB bit 5) on the UNO and PB7 (PORTB bit 7) on the MEGA.
> >
> > Best wishes,
> > Tristan
> >
> >
> > On 2021-05-21 08:54, tristan wrote:
> >> Hi Michael,
> >>
> >>> I do not see the word 'marker' defined. Should it have been part of
> >>> the basic system, or do I need to pull it from somewhere?
> >>
> >> It is not part of the basic system, it is defined in this file.
> >>
> >> avr8/lib/forth2012/core-ext/marker.frt
> >>
> >> Using marker is efficient/good practice/etc. but it is not a necessary
> >> requirement to do below.
> >>
> >>> Then I'd like to see about doing something real simple, like turning
> >>> an LED on/off.  It's sort of a hardware person's approach to 'Hello
> >>> World!'  :)
> >>
> >> http://amforth.sourceforge.net/TG/recipes/Arduino-HelloWorld.html
> >>
> >> IIRC the MEGA and UNO have the built-in led on the same pin (port bit).
> >>
> >> The definitions for the chip can be found in this file
> >>
> >> avr8/devices/atmega2560/atmega2560.frt
> >>
> >> These, or extracts from, will need to be loaded into the basic system.
> >> So longer term, being able to load forth definition non-interactively
> >> from a file is very useful. There are programs in the tools directory
> >> - amforth-shell.py being the one I use.
> >>
> >>
> >> Best wishes,
> >> Tristan
> >>
> >>
> >>
> >> On 2021-05-21 05:25, Michael Picco wrote:
> >>> Hello,
> >>>
> >>> As mentioned earlier, it's now working.
> >>> I do not see the word 'marker' defined.  Should it have been part of
> >>> the basic system, or do I need to pull it from somewhere?
> >>> Then I'd like to see about doing something real simple, like turning
> >>> an LED on/off.  It's sort of a hardware person's approach to 'Hello
> >>> World!'  :)
> >>>
> >>> Kind regards,
> >>>
> >>> Michael
> >>> K6MLE
> >>>
> >>>
> >>> On 5/20/2021 12:41 PM, Michael Picco wrote:
>  I should add the following changes to Craig Lindley's write-up:
> 
>  Step 3:
>  Under Win10, the correct file location for avrasm2.exe will be:
>  c:\Program
>  Files(86)\Atmel\Studio\7.0\toolchain\avr8\avrassembler\avrasm2.exe
> 
>  Also needed in the work directory isatmega256.asm and m2560def.inc
> 
>  The image of the directory structure didn't post to the list, so
>  I'm showing it below (my work directory is called
>  "amforth-ATmega2560-6.9":
> 
>  -- appl
>  -- arm
>  -- avr8
>  -- common
>  -- doc
>  -- examples
>  -- msp430
>  -- risc-v
>  -- shared
>  -- tests
>  -- tools
>  -- words
>  atmega256.asm
>  avrasm2.exe
>  device.asm (for the 2560)
>  device.inc (for the 2560)
>  dict_appl.inc
>  dict_appl_core.inc
>  LICENSE.txt
>  m2560def.inc
>  make.bat
>  readme.txt
>  uno.asm
> 
>  Hope this helps!
> 
>  Kind regards,
> 
>  Michael
>  K6MLE
> 
> 
>  On 5/20/2021 11:56 AM, Michael Picco wrote:
> > Hello All!
> >
> > I have finally had success!
> > It turns out that the .eep and .hex files I was flashing into the
> > 2560 were corrupted!
> > I followed Craig Lindley's write-up with modifications for the 2560.
> > Changed the make.bat file to read: avrasm2.exe -fI -o
> > atmega2560.hex -e atmega2560.eep -l atmega2560.lst -I
> > g:\amforth-atmega2560\common -I g:\amforth-atmega2560\avr8 -I
> > g:\amforth-atmega2560\avr8\drivers -I include -v0 atmega256.asm
> >
> > This is the resulting file structure prior to executing make.bat:
> >
> > The fuse setting in Studio 7 were set as follows:
> > E: 0xFF, H: 0xDC, L:0xFF
> >
> > Programmed the fuses; set the new files up in Studio 7 for flash
> > and EEPROM; programmed the .hex and .eep files.
> >
> > Have a nice prompt for "amforth 6.9 ATmega2560 Forthduino" !!!
> >
> > I'm hoping this exercise might help others.
> >
> > Kind regards,
> >
> > Michael
> > K6MLE
> >
> > On 5/18/2021 8:51 AM, tristan wrote:
> >> Hello Michael,
> >>
> >> Getting AmForth up and running from archive hex files on a
> >> mega2560 is 

Re: [Amforth] Newbie with a mega2560

2021-05-20 Thread George Herzog
Thanks, knowing what it takes for a successful installation is a valuable
contribution to AmForth users.

The ATmega2560 is very appealing as the added i/o ports make it much more
versatile than the ATmega328p.

On Fri, May 21, 2021 at 3:42 AM Michael Picco  wrote:

> I should add the following changes to Craig Lindley's write-up:
>
> Step 3:
> Under Win10, the correct file location for avrasm2.exe will be:
> c:\Program
> Files(86)\Atmel\Studio\7.0\toolchain\avr8\avrassembler\avrasm2.exe
>
> Also needed in the work directory isatmega256.asm and m2560def.inc
>
> The image of the directory structure didn't post to the list, so I'm
> showing it below (my work directory is called "amforth-ATmega2560-6.9":
>
> -- appl
> -- arm
> -- avr8
> -- common
> -- doc
> -- examples
> -- msp430
> -- risc-v
> -- shared
> -- tests
> -- tools
> -- words
> atmega256.asm
> avrasm2.exe
> device.asm (for the 2560)
> device.inc (for the 2560)
> dict_appl.inc
> dict_appl_core.inc
> LICENSE.txt
> m2560def.inc
> make.bat
> readme.txt
> uno.asm
>
> Hope this helps!
>
> Kind regards,
>
> Michael
> K6MLE
>
>
> On 5/20/2021 11:56 AM, Michael Picco wrote:
> > Hello All!
> >
> > I have finally had success!
> > It turns out that the .eep and .hex files I was flashing into the 2560
> > were corrupted!
> > I followed Craig Lindley's write-up with modifications for the 2560.
> > Changed the make.bat file to read: avrasm2.exe -fI -o atmega2560.hex
> > -e atmega2560.eep -l atmega2560.lst -I g:\amforth-atmega2560\common -I
> > g:\amforth-atmega2560\avr8 -I g:\amforth-atmega2560\avr8\drivers -I
> > include -v0 atmega256.asm
> >
> > This is the resulting file structure prior to executing make.bat:
> >
> > The fuse setting in Studio 7 were set as follows:
> > E: 0xFF, H: 0xDC, L:0xFF
> >
> > Programmed the fuses; set the new files up in Studio 7 for flash and
> > EEPROM; programmed the .hex and .eep files.
> >
> > Have a nice prompt for "amforth 6.9 ATmega2560 Forthduino" !!!
> >
> > I'm hoping this exercise might help others.
> >
> > Kind regards,
> >
> > Michael
> > K6MLE
> >
> > On 5/18/2021 8:51 AM, tristan wrote:
> >> Hello Michael,
> >>
> >> Getting AmForth up and running from archive hex files on a mega2560
> >> is reasonably straightforward, however, I don't use Microchip Studio
> >> version 7 or win10 so I can't help with this tool set. I hope you
> >> able to translate the macos/linux to your tools - and if so a
> >> write-up would be very welcome!
> >>
> >> As pointed out you need a programmer (such as usbtiny, usbasp,
> >> avrisp2 etc.) and a program to talk to the programmer (such as avrdude).
> >>
> >> Both atmega2560.hex and atmega2560.eep.hex need to be written to the
> >> mega2560's flash/eeprom. Below are the command lines I use with avrdude
> >>
> >> avrdude -p m2560 -c usbtiny -U flash:w:atmega2560.hex:i
> >> avrdude -p m2560 -c usbtiny -U eeprom:w:atmega2560.eep.hex:i
> >>
> >> Flashing these file will overwrite any existing bootloader. It is
> >> worth considering whether you are able to reverse this should you
> >> wish to, before flashing the above files.
> >>
> >> If your mega2560 is an Arduino style board, and the default fuses
> >> unchanged, then IIRC there is no need to reprogram the fuses.
> >>
> >> Once the files have been flashed, you should be able to connect to
> >> the mega2560 over serial using 38400 8N1. I use minicom and
> >> amforth-shell.py You will need to identify the name of the serial
> >> device created by the USB to SERIAL chip on your board/setup to use
> >> any serial program.
> >>
> >> Once connected you have the AmForth interpreter prompt and can
> >> interact, compile new words, and generally use the system. However,
> >> AmForth is modular and not all functionality is contained in the
> >> flashed hex files. For I2C and SPI new words need to be defined.
> >> These definitions are already available within the archive, but need
> >> to be loaded onto a "new" AmForth system. I find amforth-shell.py
> >> very helpful for automating this process.
> >>
> >> The cookbook is a great place to see examples of how things can be done
> >>
> >> http://amforth.sourceforge.net/TG/Cookbook.html
> >>
> >> And for I2C, below is very helpful
> >>
> >> http://amforth.sourceforge.net/TG/recipes/I2C-Generic.html
> >>
> >> Let us know how you get on.
> >>
> >>
> >> Best wishes,
> >> Tristan
> >>
> >>
> >>
> >> On 2021-05-18 14:31, BK Navarette wrote:
> >>> Be careful, the fuse settings particularly the boot size is different
> >>> for flash forth vs amforth.
> >>>
> >>> Brian
> >>>
> >>> On 5/18/21 5:30 AM, PETREMANN Marc wrote:
>  Hello,
>  I have not used Amforth
>  But the installation mechanisms are the same as for FlashForth:
> 
> https://arduino-forth.com/article/FORTH_FlashForth_installation_installerFlashForth
> 
>  once FORTH is installed, you must write the programs in FORTH
>  language and
>  have them compile by FORTH on the ARDUINO card.
>  FORTH is an interpreter and a 

Re: [Amforth] Newbie getting started with AVR128DA48

2020-12-30 Thread George Herzog
Both 328eForth and FlashForth wpuld be easier starting points for a newbie.

If one must use AmForth, studying the directory structure and content is
key to finding out how to compile to a specific target.

On Tue, Dec 29, 2020, 11:22 PM Brian  wrote:

> Perhaps the Arduino controlled by Eforth would be a good help. It has
> the full assembly code explained for eforth might be a good jumping off
> point its available at
>
> http://www.forth.org/OffeteStore/OffeteStore.html. A good read no matter
> what.
>
> Brian-in-ohio
>
> On 12/29/20 4:05 AM, Stephen D wrote:
> > Hi all,
> > would like to try running amforth on one of the new AVR processors, the
> > AVR128DA48 to be exact. A Curiosity Nano board turned up this week and
> I'm
> > keen to give it a try.
> >
> > Am a total newb with regards to amforth and forth in general but have
> > plenty of AVR programming experience, both in C and assembler. Have
> looked
> > through the User and Technical Guides but not found an answer to my
> > question:
> >
> > How do you define a new AVR8 chip within amforth?
> >
> > I have looked through the files under /avr8/devices/atmega* e.g.
> > device.asm, device.inc etc. They all claim to be "generated
> automatically".
> > I have not been able to find where the automatic generation is performed.
> > Is anyone able to point me in the right direction please?
> >
> > Thanks,
> > Stephen
> >
> > ___
> > Amforth-devel mailing list for http://amforth.sf.net/
> > Amforth-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/amforth-devel
>
>
> ___
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>

___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


Re: [Amforth] List of Supported Device Features in Amforth Documentation?

2020-10-23 Thread George Herzog
Frankly, making everything USB dependent takes you into trouble.
USB is to some extent proprietary, where as RS-232, SPI, and I2C are easier
to deploy.

Early versions of the Raspberry Pi had deeply constrained power
distribution. That may be a source of further woes.

Perhaps a shift to an STM324xx device with multiple available USARTs and
Mecrisp-Stellaris Forth would be more appropriate than a Raspberry Pi with
Linux.

Individual wikis for each device would certainly be nice in AmForth, but I
suspect this is suffering sufficient manpower to maintain. There are ARM
fuse selection applications available that can be somewhat useful.


On Fri, Oct 23, 2020, 6:54 AM  wrote:

> Hi!
>
>
> Summary: I believe you could greatly increase the
> number of Amforth users with little effort providing
> one Wiki page per hardware device. There you would
> provide fuse settings, name of a suitable binary,
> parameters for the flasher etc. in order to reduce the
> frustration of a rookie to see the first Forth prompt.
> It's only 20-50 devices, that's not much compared to
> the list of devices in Arch Linux for example (I found
> my specific laptop model there...).
> SourceForge offers a Wiki very suitable for that!
>
>
> In Detail:
>
> I'm a fellow open source guy, running a project
> here on SourceForge for a living:
> https://sourceforge.net/projects/project-open/
> Also, 30 years ago I wrote a Forth for Inmos
> Transputers...
>
>
> So: Congratulations to your work on Amforth!
> I managed to get it running on a barebone AtMega
> 328 for a hobby project (a tracked robot with my
> son...).
>
> I implemented drivers for both stepper motors
> and DC motors with angle coders without too much
> trouble and to send Forth commands over SPI.
>
> However, I got some trouble trying to connect
> multiple 328s to a single RasPi and finally serious
> trouble with spikes from the DC motors affecting
> the SPI bus :-(
>
> For the next iteration I'd like to decouple the
> various I/O subsystems electrically and use UART
> over USB for communication in order to address the
> issues both with multiple devices (USB hub as PI
> HAT) and noise (USB has differential signaling...)
>
> So, I'd like to use a 32U4 or Mega 2560 or similar
> for each subsystem and a RasPi Zero W as a base,
> but I haven't yet purchased anything.
> Here some information on the supported features
> would come in handy. I've spent several hours
> trying to understand if/how Amforth supports
> USB/UART in these model. 6.9 doesn't seem to
> support it at all, correct?
>
>
> There isn't much space in a robot, and USB cables
> are surprisingly bulky. And now imagine that I'd
> somehow need to have 2x USB for each Atmega...
>
> I wonder if I'm the only one trying to build a more
> complex system using Amforth or if others had
> similar problems...
>
> I have also found very few postings in the Internet
> from people connecting multiple Arduinos to
> a RasPI or to build bigger projects in general.
> That's precisely where I see the value of Amforth,
> because it introduces a protocol layer that is
> easy to debug and decouples the subsystems.
>
>
> Cheers, and keep up the good work!
> Frank
>
>
>
> ___
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>

___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


Re: [Amforth] rshift not zero padded

2020-09-19 Thread George Herzog
It's a common display situation in Forth. Leading zeros aren't display,
even when they exist.

On Sat, Sep 19, 2020, 2:24 AM Mark Roth  wrote:

> Is there a reason that when using rshift or 2/ the most significant bit
> isn't zero padded? lshift and 2* do this correctly. I was trying to
> implement a simple back and forth led on a port by starting with a value of
> 1 in the the port. Moving from right to left in the port works perfectly
> but when moving from left to right using either rshift or 2/ every other
> bit is set high so after a couple of back and forths the port is filled
> with 1s.
>
> I can see that the lshift says it is zero padded but the rshift doesn't say
> that it is. Is there a reason for this? The 2012 specs seem to say that
> rshift is zero padded as well.
> http://lars.nocrew.org/forth2012/core/RSHIFT.html
>
> Perhaps it's just my noob code that is the problem.
>
> : cylon
> > $ff ddra ! 1 porta !
> > begin 40 ms
> > 8 0 do porta @ 2* porta ! 40 ms loop
> > 8 0 do porta @ 2/ porta ! 40 ms loop
> > key? until ;
>
>
> It appears to work correctly in one direction but not the other.
>
> Thanks,
> Mark
>
> ___
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>

___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel