Sida 1 av 1

makefile problem

Postat: 1 mars 2012, 22:25:21
av Korken
Godagens!

Jag håller på att fixa en bättre makefile för att få den hitta alla mina filer rekursivt.
Problemet är att den inte vill kompilera mina .s (assembler) filer, kan någon se varför?
Jag har krigat med detta hela dagen idag och börjar bli lite lätt less...

Allt körs på CodeBench för ARM under Ubuntu 11.10.

Tack på förhand!
Jag är kanske inte så bra makefile hacker som jag trodde. ;)

Error:

Kod: Markera allt

korken@korken-laptop:~/Programming/KFly_STM32F4$ make all

arm-none-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant --no-builtin-memset --no-builtin-memcpy -I./include -I./CMSIS -I./STMkorken@korken-laptop:~/Programming/KFly_STM32F4$ make all
arm-none-eabi-gcc -c -mthumb -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant --no-builtin-memset --no-builtin-memcpy -I./include -I./CMSIS -I./STM32F4xx_StdPeriph_Driver/inc -g -o CMSIS/startup_stm32f4xx.o CMSIS/startup_stm32f4xx.s > CMSIS/startup_stm32f4xx.lst
CMSIS/startup_stm32f4xx.s: Assembler messages:
CMSIS/startup_stm32f4xx.s: Warning: end of file not at end of a line; newline inserted
CMSIS/startup_stm32f4xx.s:1: Error: junk at end of line, first unrecognized character valued 0x7f
CMSIS/startup_stm32f4xx.s:1: Error: junk at end of line, first unrecognized character valued 0x1
CMSIS/startup_stm32f4xx.s:1: Error: junk at end of line, first unrecognized character is `('
CMSIS/startup_stm32f4xx.s:1: Error: junk at end of line, first unrecognized character valued 0x1
CMSIS/startup_stm32f4xx.s:1: Error: bad instruction `�'
CMSIS/startup_stm32f4xx.s:1: Error: junk at end of line, first unrecognized character valued 0x5
CMSIS/startup_stm32f4xx.s:1: Error: junk at end of line, first unrecognized character is `('
CMSIS/startup_stm32f4xx.s:1: Error: junk at end of line, first unrecognized character valued 0x8
CMSIS/startup_stm32f4xx.s:1: Error: junk at end of line, first unrecognized character valued 0x5
CMSIS/startup_stm32f4xx.s:1: Error: bad instruction `a&'
CMSIS/startup_stm32f4xx.s:1: Error: bad instruction `aeabi'
CMSIS/startup_stm32f4xx.s:1: Error: junk at end of line, first unrecognized character valued 0x1
CMSIS/startup_stm32f4xx.s:1: Error: junk at end of line, first unrecognized character valued 0x5
CMSIS/startup_stm32f4xx.s:1: Error: junk at end of line, first unrecognized character valued 0x6
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x6
CMSIS/startup_stm32f4xx.s:2: Error: unknown pseudo-op: `.symtab'
CMSIS/startup_stm32f4xx.s:2: Error: unknown pseudo-op: `.strtab'
CMSIS/startup_stm32f4xx.s:2: Error: unknown pseudo-op: `.shstrtab'
CMSIS/startup_stm32f4xx.s:2: Error: unknown pseudo-op: `.arm.attributes'
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x1b
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x1
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x6
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character is `4'
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x2
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character is `!'
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x1
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x3
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character is `4'
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x1
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character is `0'
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x8
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x3
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character is `4'
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x1
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character is `,'
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x3
CMSIS/startup_stm32f4xx.s:2: Error: bad instruction `p'
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character is `4'
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character is `0'
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x1
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x11
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x3
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character is `['
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character is `<'
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x1
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x1
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x2
CMSIS/startup_stm32f4xx.s:2: Error: bad instruction `�'
CMSIS/startup_stm32f4xx.s:2: Error: bad instruction `p'
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x7
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x5
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x4
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x10
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x3
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character is `('
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x1
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x1
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x3
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x1
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x3
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x2
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x3
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x3
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x3
CMSIS/startup_stm32f4xx.s:2: Error: junk at end of line, first unrecognized character valued 0x4
make: *** [CMSIS/startup_stm32f4xx.o] Error 1
Makefile:

Kod: Markera allt

OBJECTS = $(CSRCS:.c=.o) $(ASRCS:.s=.o)
CSRCS   = $(wildcard *.c) $(wildcard */*.c)
ASRCS   = $(wildcard *.s) $(wildcard */*.s)

OPTIMIZATION = 1

COMMON = -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant --no-builtin-memset --no-builtin-memcpy
CFLAGS = $(COMMON) -std=gnu99 -O$(OPTIMIZATION) -I./include -I./CMSIS -I./STM32F4xx_StdPeriph_Driver/inc -g
AFLAGS = $(COMMON) -I./include -I./CMSIS -I./STM32F4xx_StdPeriph_Driver/inc -g
LDFLAGS = $(COMMON) -nostdlib -Tstm32f4x_flash.ld -Wl,--build-id=none

GCC = arm-none-eabi-gcc
SIZE = arm-none-eabi-size

all: main.elf
	@$(SIZE) *.elf	

main.elf: $(OBJECTS)
	$(GCC) $(LDFLAGS) $(OBJECTS) -o main.elf
	
clean:
	rm -f $(OBJECTS)

.c.o :
	$(GCC) $(CFLAGS) -c $< -o $(<:.c=.o)

.s.o :
	$(GCC) -c -mthumb $(AFLAGS) -o $(<:.s=.o) $< > $(<:.s=.lst)

Re: makefile problem

Postat: 1 mars 2012, 23:16:00
av snigelen
Utan att kolla (eller ha koll på) alla detaljer, så ser ändå mellanslaget i "> $" på sista raden i din Makefile misstänkt ut.

Kod: Markera allt

$(GCC) -c -mthumb $(AFLAGS) -o $(<:.s=.o) $< > $(<:.s=.lst)

Re: makefile problem

Postat: 1 mars 2012, 23:24:01
av snigelen
Eller det kanske är rätt. Det jag reagerade på var att du har en -o utfil och därefter en > som skall skicka någon slags utdata till en annan fil. Men jag är inte riktigt van vid just den typen av konstruktion (typ (<:.s=.lst)), så någon annan kan nog komma med något bättre.

Re: makefile problem

Postat: 3 mars 2012, 10:51:49
av bos
"<:.s=.o" betyder att make ändrar namn på aktuell fil/target. FOO.s blir alltså FOO.o, och i sista parametern FOO.lst. Redirecten dit är helt korrekt, eftersom det är list-data som hamnar på stdout och redirectas ner i filen.

Re: makefile problem

Postat: 3 mars 2012, 10:55:24
av bos
Korken skrev:Jag håller på att fixa en bättre makefile för att få den hitta alla mina filer rekursivt.
Problemet är att den inte vill kompilera mina .s (assembler) filer, kan någon se varför?
Jag ser inga felaktigheter i din make-fil, och om du tittar på felmeddelandet ser du att det kommer från din assembler, inte make:
CMSIS/startup_stm32f4xx.s: Assembler messages:
CMSIS/startup_stm32f4xx.s: Warning: end of file not at end of a line; newline inserted
CMSIS/startup_stm32f4xx.s:1: Error: junk at end of line, first unrecognized character valued 0x7f
Utan att ha sett filens innehåll och utan att orka spekulera i all oändlighet gissar jag att filen är i unicode och att din assembler inte klarar unicode.

I ett skal, kör "file CMSIS/startup_stm32f4xx.s". Vad får du för svar?

Re: makefile problem

Postat: 3 mars 2012, 14:53:14
av snigelen
Den filen är (uppenbarligen, tycker jag) överskriven med något som inte är assembler. Men jag vet inte riktigt varför. Jag lyckades få något liknande då källfilen hette .S och inte .s, så att "<:.s=.o" resulterade i samma namn som källfilen.

Re: makefile problem

Postat: 4 mars 2012, 12:04:20
av Korken
Nu så har jag fått det att fungera! :D
Det var kodningen på filen som var knasig, så jag kopierade allt i filen och gjorde en ny och poff så fungerade det.

Tack för hjälpen!

Re: makefile problem

Postat: 4 mars 2012, 12:13:50
av bos
Gött att kunna gissa rätt ibland :)