Ro5bert / avra

Assembler for the Atmel AVR microcontroller family
GNU General Public License v2.0
153 stars 39 forks source link

Only the first .includepath appears to have an effect #30

Closed jameswilddev closed 3 years ago

jameswilddev commented 3 years ago

Reproduction steps:

main.asm is as follows:

.includepath "a"
.includepath "b"
.include "foo.asm"
.include "bar.asm"

The file listing is as follows:

./a/foo.asm
./b/bar.asm
./main.asm
./makefile

The output is as follows:

avra -o main.hex main.asm
AVRA: advanced AVR macro assembler (version 1.4.2)
Pass 1...
main.asm(4) : Error   : Cannot find include file: bar.asm
Warning : No .DEVICE definition found. Cannot make useful address range check !
Warning : No .DEVICE definition found. Cannot make useful address range check !
Warning : No .DEVICE definition found. Cannot make useful address range check !
make: *** [makefile:2: all] Error 1
The terminal process "/bin/bash '-c', 'make'" failed to launch (exit code: 2).

It looks like only the first .includepath directive has an effect. In the source, I can see that it takes a different route depending upon whether any include paths have been added yet (https://github.com/Ro5bert/avra/blob/7a6ca91bd0b585631d2d6276c840734ea7ac3a31/src/directiv.c#L459). I'm wondering if that add_arg's first argument might be incorrect (maybe it's a pointer to a copy on the stack?). Will have to see!

I've ruled out a problem with include paths in general by replacing .includepath with command line arguments to avra - that works.