-----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

Reply via email to