Assembling Amforth5.0 for an Atmega328P using the Raspberry Pi avra
instance:

Untaring  Amforth.5.0.tar.gz, I copied the "Appnotes" directory from
Studio4 (on my desktop) into the core directory.
Using template.asm edited for the atmega328p, set  ".equ F_CPU = 16000000"
(and and commented out the 1wire interface settings and added '.include
"devices/atmega328p/device.inc"' to the dict_appl.inc file):

pi@raspberrypi /home/amforth50/appl/template $ sudo avra  -fI  -I
../../core -I ../../core/devices/ -I ../../core/Appnotes  template.asm

Pass 1...
template.asm(42) : Error   : Found no label/variable/constant named bm_ASYNC
template.asm(46) : Error   : Found no label/variable/constant named
bm_ENABLE_TX

Looking in core/devices/usart_0.asm, both bm_ASYNC and bm_ENABLE_TX are
there with .equ.
A simplistic analysis suggests that there is an issue with forward
referencing with avra that avrasm.exe or Studio4 doesn't have.  Thinking
that the .include order is important, I simply moved

.include "drivers/usart_0.asm"

just above

.set WANT_ISR_RX = 1 ; interrupt driven receive
.set WANT_ISR_TX = 0 ; send slowly but with less code space

in my template file and re-assembled with avra...

Pass 1...
Pass 2...
../../core/words/brackettick.asm(6) : Warning : A .DB segment with an odd
number of bytes is detected. A zero byte is added.
../../core/words/tick.asm(6) : Warning : A .DB segment with an odd number
of bytes is detected. A zero byte is added.
done

Assembly complete with no errors (2 warnings).
Segment usage:
   Code      :      4223 words (8446 bytes)
   Data      :       221 bytes
   EEPROM    :        82 bytes


The resulting template.hex and template.eep.hex ( > template.eep) were
flashed on to a Atmega328P using avrdude.  The terminal prompt came up!  I
loaded atmega328p.frt and a simple stepper motor program and it ran.


Amforth-5.1 to be continued...


On Tue, Aug 13, 2013 at 7:05 AM, Mark Malmros <m.malm...@gmail.com> wrote:

> Erich, Keith, Enoch, Christian and all other interested parties...
>
> To double check my luck I started with a clean Debian image
> (2013-wheezy-raspian.img (armhf)) on a Raspberry pi  which comes complete
> with all the build utilities - having only to add automake...
>
> $cd /home
> $ sudo apt-get install automake
>     ...
>
> $ git clone git://avra.git.sourceforge.net/gitroot/avra/avra
>     ...
> $ cd avra/src
>     ...
> After a number of iterations and failed compilations, the following works:
> As the git clone had no configure.in, I copied that file from the
> avra-1.3.0 tarball as well as Makefile.am.  (The Makefile.linux in
> src/makefiles wouldn't build the target for reasons I can't figure out -
> the avra-1.3.0 Makefile.am is wonderfully simple!)  For both files I
> literally copied and pasted from my Desktop into the pi.
>
> $sudo nano configure.in
>     ...
> $sudo nano Makefile.am
>     ...
>
> I followed the compile instructions for linux  in the avra/doc/README.txt
> file running everything as sudo:
>
> $ sudo aclocal
> $ sudo autoconf
> $ sudo automake -a
>
> automake complains about missing files NEWS, README, AUTHORS, and
> ChangeLog. (Seriously?)
>
> $ sudo touch NEWS
> $ sudo touch README
> $ sudo touch AUTHORS
> $ sudo touch ChangeLog
>
> $ sudo automake -a
> $ sudo ./configure
> $ sudo make && sudo make install
>
> compilation fails with similar (not the same) terminal messages as Erich
> shows... ending in:
>
>
> args.c:124:1: error: conflicting types for ‘read_args’
> args.h:77:5: note: previous declaration of ‘read_args’ was here
> make: *** [args.o] Error 1
>
> Why two declarations for 'read_args'?
> Using nano, I simply commented out line 77 in args.h (at the end of the
> file):
>
> struct args *alloc_args(int arg_count);
> // int read_args(struct args *args, int argc, const char *argv[]);
> int add_arg(struct data_list **last_data, const char *argv);
> void free_args(struct args *args);
> void define_arg(struct args *args, int index, int type, char letter, char
> *long$
> void define_arg_int(struct args *args, int index, int type, char letter,
> char *$
>
> #endif /* end of args.h */
>
> $ sudo make
>
> pi@raspberrypi /home/avra/src $ sudo make install
> make[1]: Entering directory `/home/avra/src'
>  /bin/mkdir -p '/usr/local/bin'
>   /usr/bin/install -c avra '/usr/local/bin'
> make[1]: Nothing to be done for `install-data-am'.
> make[1]: Leaving directory `/home/avra/src'
>
> occasionally things work.
>
> To be continued...
>
>
>
> On Mon, Aug 12, 2013 at 4:12 PM, Erich Waelde <ew.fo...@nassur.net> wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Hello Mark and all,
>>
>> On 08/07/2013 01:55 PM, Mark Malmros wrote:
>> > If my "working" avra under Debian for Amforth 5.0 is of interest to
>> anyone,
>> > I'll track down the minor changes I've made and pass them along. Be
>> > forewarned: as with life, I have no idea how I got here or what I am
>> doing,
>> > but occasionally it all seems to work.
>>
>> Yes, definitely of interest. Now, to make this more interesting to anyone
>> else lurking on the list, I thought, I'll give it a try:
>>
>> $ mkdir tmp.avra; cd tmp.avra
>> $ cp -a ...path-to-my-old-avra/ avra-1
>> $ ls
>> avra-1
>> $ mkdir avra-2
>> $ cd avra-2
>> $ git clone git://avra.git.sourceforge.net/gitroot/avra/avra
>> Cloning into 'avra'...
>> remote: Counting objects: 528, done.
>> remote: Compressing objects: 100% (435/435), done.
>> remote: Total 528 (delta 276), reused 286 (delta 75)
>> Receiving objects: 100% (528/528), 1.03 MiB | 442.00 KiB/s, done.
>> Resolving deltas: 100% (276/276), done.
>> Checking connectivity... done
>> $ cd avra/src
>> $ > make -f makefiles/Makefile.linux
>> gcc -Wall -O3   -c -o avra.o avra.c
>> avra.c: In function ‘main’:
>> avra.c:136:5: warning: passing argument 3 of ‘read_args’ from
>> incompatible pointer type [enabled by default]
>>      c = read_args(args, argc, argv);
>>      ^
>> In file included from avra.c:34:0:
>> args.h:77:5: note: expected ‘const char **’ but argument is of type ‘char
>> **’
>>  int read_args(struct args *args, int argc, const char *argv[]);
>>      ^
>> gcc -Wall -O3   -c -o device.o device.c
>> gcc -Wall -O3   -c -o parser.o parser.c
>> gcc -Wall -O3   -c -o expr.o expr.c
>> gcc -Wall -O3   -c -o mnemonic.o mnemonic.c
>> gcc -Wall -O3   -c -o directiv.o directiv.c
>> gcc -Wall -O3   -c -o macro.o macro.c
>> gcc -Wall -O3   -c -o file.o file.c
>> gcc -Wall -O3   -c -o map.o map.c
>> gcc -Wall -O3   -c -o coff.o coff.c
>> coff.c: In function ‘write_coff_file’:
>> coff.c:167:37: warning: variable ‘StringsOffset’ set but not used
>> [-Wunused-but-set-variable]
>>      int LinesOffset, SymbolsOffset, StringsOffset, RawOffset;
>>                                      ^
>> coff.c: In function ‘parse_stabs’:
>> coff.c:495:49: warning: variable ‘pEnd’ set but not used
>> [-Wunused-but-set-variable]
>>      char *pString, *p2, *p3, *p4, *p5, *pType, *pEnd, *pp, *pJoined;
>>                                                  ^
>> coff.c: In function ‘parse_stabn’:
>> coff.c:646:52: warning: variable ‘pEnd’ set but not used
>> [-Wunused-but-set-variable]
>>      char *p1, *p2, *p3, *p4, *pLabel, *pFunction, *pEnd;
>>                                                     ^
>> gcc -Wall -O3   -c -o args.o args.c
>> args.c:124:1: error: conflicting types for ‘read_args’
>>  read_args(struct args *args, int argc, char *argv[])
>>  ^
>> In file included from args.c:33:0:
>> args.h:77:5: note: previous declaration of ‘read_args’ was here
>>  int read_args(struct args *args, int argc, const char *argv[]);
>>      ^
>> make: *** [args.o] Error 1
>>
>> So it does not build. :-(
>> But my old stuff does, so let's look at the diff
>>
>> # --- start-of-diff ------------------------------------
>> diff -Naur avra-2/avra/src/args.c avra-1/src/args.c
>> - --- avra-2/avra/src/args.c    2013-08-12 21:45:02.811727443 +0200
>> +++ avra-1/src/args.c   2012-02-28 20:25:32.555406533 +0100
>> @@ -52,7 +52,7 @@
>>  }
>>
>>  const struct dataset *
>> - -match_dataset(const struct dataset datasets[], const char *key)
>> +match_dataset(const struct dataset const datasets[], const char *key)
>>  {
>>         const struct dataset *ds;
>>         for (ds = datasets;
>> @@ -66,7 +66,7 @@
>>  }
>>
>>  void
>> - -print_dataset(const struct dataset datasets[])
>> +print_dataset(const struct dataset const datasets[])
>>  {
>>         const struct dataset *ds;
>>         printf("either ");
>> @@ -121,7 +121,7 @@
>>  }
>>
>>  int
>> - -read_args(struct args *args, int argc, char *argv[])
>> +read_args(struct args *args, int argc, const char *argv[])
>>  {
>>         int i, j, k, ok, i_old;
>>         struct data_list **last_data;
>> diff -Naur avra-2/avra/src/avra.c avra-1/src/avra.c
>> - --- avra-2/avra/src/avra.c    2013-08-12 21:45:02.811727443 +0200
>> +++ avra-1/src/avra.c   2012-09-30 15:35:12.557700410 +0200
>> @@ -38,6 +38,7 @@
>>  #define debug 0
>>
>>  const char *title =
>> +  "avra: 2012-08-16 ew a6e8b2957953810dae6467eeb4905bfc5ea6c33e\n"
>>    "AVRA: advanced AVR macro assembler Version %i.%i.%i Build %i (%s)\n"
>>    "Copyright (C) 1998-2010. Check out README file for more info\n"
>>    "\n"
>> @@ -95,7 +96,7 @@
>>  static struct segment_info DATA_SEG;
>>  static struct segment_info EEPROM_SEG;
>>
>> - -int main(int argc, char *argv[])
>> +int main(int argc, const char *argv[])
>>  {
>>    int show_usage = False;
>>    struct prog_info *pi;
>> diff -Naur avra-2/avra/src/device.c avra-1/src/device.c
>> - --- avra-2/avra/src/device.c  2013-08-12 21:45:02.811727443 +0200
>> +++ avra-1/src/device.c 2012-09-30 15:34:49.199369981 +0200
>> @@ -104,6 +104,7 @@
>>    { "ATmega328P",       16384,     0x100,     2048,   1024,
>> DF_NO_EICALL|DF_NO_EIJMP|DF_NO_ELPM|DF_NO_ESPM},
>>    {   "ATmega32",       16384,      0x60,     2048,   1024,
>> DF_NO_EICALL|DF_NO_EIJMP|DF_NO_ELPM|DF_NO_ESPM},
>>    {  "ATmega603",       32768,      0x60,     4096,   2048,
>> DF_NO_EICALL|DF_NO_EIJMP|DF_NO_MUL|DF_NO_MOVW|DF_NO_LPM_X|DF_NO_ELPM|DF_NO_SPM|DF_NO_ESPM|DF_NO_BREAK},
>> +  { "ATmega644P",       32768,     0x100,     4096,   2048,
>> DF_NO_EICALL|DF_NO_EIJMP|DF_NO_ELPM|DF_NO_ESPM},
>>    {  "ATmega103",       65536,      0x60,     4096,   4096,
>> DF_NO_EICALL|DF_NO_EIJMP|DF_NO_MUL|DF_NO_MOVW|DF_NO_LPM_X|DF_NO_ELPM_X|DF_NO_SPM|DF_NO_ESPM|DF_NO_BREAK},
>> // 137 - EICALL - EIJMP - MUL(6) - MOVW - LPM_X(2) - ELPM_X(2) - SPM - ESPM
>> - BREAK = 121
>>    {  "ATmega104",       65536,      0x60,     4096,   4096,
>> DF_NO_EICALL|DF_NO_EIJMP|DF_NO_ESPM}, // Old name for mega128
>>    {  "ATmega128",       65536,     0x100,     4096,   4096,
>> DF_NO_EICALL|DF_NO_EIJMP|DF_NO_ESPM}, // 137 - EICALL - EIJMP - ESPM = 134
>> (Data sheet says 133 but it's wrong)
>> @@ -145,6 +146,7 @@
>>                 if(!nocase_strcmp(name, device_list[i].name)) {
>>                         LastDevice=i;
>>              def_dev(pi);
>> +
>>  pi->dseg->lo_addr=device_list[LastDevice].ram_start; /* fixme: set
>> ram_start in the correct place */
>>                         return(&device_list[i]);
>>                 }
>>                 i++;
>> @@ -188,8 +190,7 @@
>>         return(True);
>>  }
>>
>> - -void
>> - -list_devices(void)
>> +void list_devices()
>>  {
>>    int i = 1;
>>    printf("Device name | Flash size | RAM start | RAM size | EEPROM size
>> |  Supported\n"
>> diff -Naur avra-2/avra/src/stdextra.c avra-1/src/stdextra.c
>> - --- avra-2/avra/src/stdextra.c        2013-08-12 21:45:02.811727443
>> +0200
>> +++ avra-1/src/stdextra.c       2012-02-28 20:25:32.559406275 +0100
>> @@ -191,7 +191,7 @@
>>  snprint(char ** buf, size_t *limit, const char * const str) {
>>         int rc;
>>         rc = snprintf(*buf, *limit, "%s", str);
>> - -     if (rc <= (int)*limit)
>> +       if (rc <= *limit)
>>                 *buf += rc, *limit -= rc;
>>         else
>>                 *limit = 0;
>> @@ -213,7 +213,7 @@
>>                         snprint(&ptr, &limit, ", ");
>>         }
>>         rc = snprintf(ptr, limit, "\"%s\"", str_list[i]);
>> - -     if (rc <= (int)limit)
>> +       if (rc <= limit)
>>                 ptr += rc, limit -= rc;
>>         else
>>                 limit = 0;
>> @@ -222,8 +222,7 @@
>>  }
>>
>>  void
>> - -test_print_list(void)
>> - -{
>> +test_print_list() {
>>         static const char * const test_value[] = {
>>                 "DEFAULT",
>>                 "IGNORE",
>> # --- end-of-diff --------------------------------------
>>
>> args.c has received a few "const" modifiers.
>> avra.c has a change in the version message and one const
>> stdextra.c has a missing cast (int) and a changed function header.
>>
>> all of these look innocent.
>>
>> devices.c has received an additional entry for atmega644p and
>> the fix I already mentioned.
>>
>> Applying this patch makes avra compile.
>>
>> $ make -f makefiles/Makefile.linux
>> gcc -Wall -O3   -c -o avra.o avra.c
>> gcc -Wall -O3   -c -o device.o device.c
>> gcc -Wall -O3   -c -o parser.o parser.c
>> gcc -Wall -O3   -c -o expr.o expr.c
>> gcc -Wall -O3   -c -o mnemonic.o mnemonic.c
>> gcc -Wall -O3   -c -o directiv.o directiv.c
>> gcc -Wall -O3   -c -o macro.o macro.c
>> gcc -Wall -O3   -c -o file.o file.c
>> gcc -Wall -O3   -c -o map.o map.c
>> gcc -Wall -O3   -c -o coff.o coff.c
>> coff.c: In function ‘write_coff_file’:
>> coff.c:167:37: warning: variable ‘StringsOffset’ set but not used
>> [-Wunused-but-set-variable]
>>      int LinesOffset, SymbolsOffset, StringsOffset, RawOffset;
>>                                      ^
>> coff.c: In function ‘parse_stabs’:
>> coff.c:495:49: warning: variable ‘pEnd’ set but not used
>> [-Wunused-but-set-variable]
>>      char *pString, *p2, *p3, *p4, *p5, *pType, *pEnd, *pp, *pJoined;
>>                                                  ^
>> coff.c: In function ‘parse_stabn’:
>> coff.c:646:52: warning: variable ‘pEnd’ set but not used
>> [-Wunused-but-set-variable]
>>      char *p1, *p2, *p3, *p4, *pLabel, *pFunction, *pEnd;
>>                                                     ^
>> gcc -Wall -O3   -c -o args.o args.c
>> gcc -Wall -O3   -c -o stdextra.o stdextra.c
>> gcc -static -o avra avra.o device.o parser.o expr.o mnemonic.o directiv.o
>> macro.o file.o map.o coff.o args.o stdextra.o -s
>>
>> $ ./avra --version
>> avra: 2012-08-16 ew a6e8b2957953810dae6467eeb4905bfc5ea6c33e
>> AVRA: advanced AVR macro assembler Version 1.3.0 Build 1 (8 May 2010)
>> Copyright (C) 1998-2010. Check out README file for more info
>>
>>    AVRA is an open source assembler for Atmel AVR microcontroller family
>>    It can be used as a replacement of 'AVRASM32.EXE' the original
>> assembler
>>    shipped with AVR Studio. We do not guarantee full compatibility for
>> avra.
>>
>>    AVRA comes with NO WARRANTY, to the extent permitted by law.
>>    You may redistribute copies of avra under the terms
>>    of the GNU General Public License.
>>    For more information about these matters, see the files named COPYING.
>>
>> I did this on 3 systems: Debian/unstable on amd64 and i486;
>> Debian/squeeze on armv7l (ecafe)
>> with identical results so far.
>>
>> So next I need to compile amforth with the executable and compare
>> the hexfiles to those of wine+avrasm2.
>>
>> Cheers,
>> Erich
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.14 (GNU/Linux)
>> Comment: Using GnuPG with Icedove - http://www.enigmail.net/
>>
>> iQIcBAEBAgAGBQJSCUGyAAoJEHx024vXVRNQ46wP/irQeEEi4WtFl0BNVd5L7fD6
>> ZaZGr/lGYZz/4QBlGDWvGCXRfa6d0moJrMrlfgcQ9JirkN+ElVfIRA9E5Vc3KvQF
>> f3vjjA0EQ3tnrOG9IxQXG1P6lbLIU0Jib4z3S4PLuyPd/SyBoHcWTV207hRfqP9p
>> hRwCUMXJw3tEgQz4mzE/3nLddKnyELMsEbsqWAvaRwYne5tKKN8upwQzSkz2AG73
>> XPgzhkN05O3SPVkF/ghe+8myF0KSPAxW0LZqlG5i0RYGx/KG9BLQONjyjoThjfJB
>> mCv7wQ0unWZPrSLkvFgCcwHJHTLF+BwP+iazq4eZkpeBi+rRwwgwHTKfaIDOj6lN
>> 5u0p+pFFyQKoSYmDzawSVha0Pw72HscHLNzbgVOXOrRvX6DiZcCJ08Fl/BGTky7p
>> gQj+zCHH/aYzte/CF0ypqef01NxnOl+un4RvOgGdkz8su2d1umaHpa/PTDEkZ8di
>> gWrlO1Cr1IIzLOZlxNtJ9ObvuKUwVL83XN920lLm+4w2O0G8VR++B4bw1QtshRQt
>> fo3wJjan8OO/H5AHzd68f8OgkpObjwkhx6m6HDT21WigUsBEMQ36P2+cAS+qq6uo
>> vifigAQ90AajZfNslCNJxe4fOi7LKMHbixRzfxZG7VOwJwwkOQ35BAS/6GOZZcZc
>> 1+wua+OTJPYbRRlnkfKH
>> =gs2Q
>> -----END PGP SIGNATURE-----
>>
>>
>> ------------------------------------------------------------------------------
>> Get 100% visibility into Java/.NET code with AppDynamics Lite!
>> It's a free troubleshooting tool designed for production.
>> Get down to code-level detail for bottlenecks, with <2% overhead.
>> Download for free and get started troubleshooting in minutes.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Amforth-devel mailing list for http://amforth.sf.net/
>> Amforth-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>>
>
>
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to