Re: [Amforth] Compiling for a headless target

2021-09-04 Thread Helge Kruse



On 31.08.21 11:29, Helge Kruse via Amforth-devel wrote:

But I want
to create a hex file with a real turnkey application that I can flash on
another ATmega2560 device. After running all Forth source code to my
"development" board I find the flash filled with the code. It should be
possible to clone the flash content to another board without sending all
the source trough a UART. The other idea I mentioned was to "dump" the
added flash memory content and create an assembler source used in the
AVR assembler.


Instead of dumping the contents from the target I found another
approach. The g4  converter makes
assembly source code from Forth code. I could use it to convert my code
to assembler code that I could add the the amForth sources.

g4 requires that the referred words are defined, so that you have to
provide stubs for words that are missing in gforth but known to amForth,
e.g. MS. But as long as you can compile in gforth you can create source
files for amForth. Including these new files in you amForth skeleton
creates a new .hex file capable to be a turnkey application, in a .hex file.



The reason to differentiate between development board and the target
device is that the target device is that the target device has only one
USART port connected. And this port is used on a RS485 field bus.


And you can flash the new .hex file on the ISP port.

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


Re: [Amforth] Compiling for a headless target

2021-09-04 Thread Erich Wälde
Hello Helge,

welcome to the list!

I'm late to the show, but anyways ...

I personally would not use the serial console for something
else, but rather use a atmega644 or similar, which features two
separate serial interfaces.

Replicating code is imho most easy, if a controller is read back
via avrdude or similar. The resulting files are then flashed to
the other devices.

Helge Kruse  writes:

> Instead of dumping the contents from the target I found another
> approach. The g4  converter makes
> assembly source code from Forth code. I could use it to convert my code
> to assembler code that I could add the the amForth sources.

:-) If you look closely, you will find quite some similarity of
the AmForth code (esp. with releases up to 5.5) with the output
of g4. I do not know for sure, but it seem that Matthias has
generated a lot of code with g4. So yes, go for it!


Using the serial interface for a rs485 connection ... now, that
I can understand :-) I have a collection of controllers "online",
descriptions start here (German text):
Vierge Dimension 2011/1
https://forth-ev.de/wiki/res/lib/exe/fetch.php/vd-archiv:4d2011-01.pdf
Judging from your name German text should not be a problem for you.

More description here:
http://amforth.sourceforge.net/Projects/RS485/RS485Bus.html

I'm very interested to hear, how you get along. Feel free to ask
about technical details.


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