Bonsoir,
Je voulais savoir si y avait possibilité de convertir le programme en asm depuis la source C, ou depuis le fichier .hex ?
Merci
Bonsoir,
Je voulais savoir si y avait possibilité de convertir le programme en asm depuis la source C, ou depuis le fichier .hex ?
Merci
Salut,
Si tu veut obtenir le code assembleur d'un fichier .hex .elf ou .c (en le compilant avant), voici un makefile qui le permet :
TARGET = atmega328p
OBJECT = main.c
COMPILER = avr-gcc -mmcu=$(TARGET) -Wall -Os -DF_CPU=16000000
OBJCOPY = avr-objcopy -O ihex
OBJCOPYBIN = avr-objcopy -I ihex -O binary
OBJCOPYELF = avr-objcopy -I binary -B avr -O elf32-avr
OBJDUMP = avr-objdump
OBJSIZE = avr-size --mcu=$(TARGET)
all: clean elf hex asm size
elf: $(OBJECT)
$(COMPILER) -o $(OBJECT).elf $(OBJECT)
hex: $(OBJECT).elf
$(OBJCOPY) $(OBJECT).elf $(OBJECT).hex
asm: $(OBJECT).elf
$(OBJDUMP) -d $(OBJECT).elf > $(OBJECT).S
size: $(OBJECT).hex
$(OBJSIZE) $(OBJECT).elf
$(OBJSIZE) $(OBJECT).hex
clean:
rm -f *.elf *.hex *.S
make all -> compile le fichier source .c en .elf, puis le transforme en .S (asm) et génère le .hex associé
make elf -> compile le fichier source .c en .elf
make hex -> transforme le .elf en .hex
make asm -> transforme le .elf en .S
make size -> affiche la taille du programme compilé .hex
make clean -> fait le ménage en supprimant tout les fichiers .elf .hex et .S du dossier courant
avr-g++ -S test.cpp
barbudor:
avr-g++ -S test.cpp
Roo ! C'est de la triche il a dit "depuis la source C, ou depuis le fichier .hex"
Ah, depuis du C ?
Alors
avr-gcc -S test.c
XD