參考資訊:
https://github.com/dwelch67/sam7s_samples
https://ww1.microchip.com/downloads/en/DeviceDoc/6175s.pdf
https://ww1.microchip.com/downloads/en/DeviceDoc/doc6175.pdf
Enable

Output

Output High

Output Low

main.s
.equ PMC_PCER, 0xfffffc10
.equ PIO_PER, 0xfffff400
.equ PIO_OER, 0xfffff410
.equ PIO_SODR, 0xfffff430
.equ PIO_CODR, 0xfffff434
.text
.align 2
.global _start
_start: b reset
_undef: b .
_swi: b .
_pabort: b .
_dabort: b .
_reserved: b .
_irq: b .
_fiq: b .
reset:
ldr r0, =PMC_PCER
ldr r1, =4
str r1, [r0]
ldr r0, =PIO_PER
ldr r1, =0x40000
str r1, [r0]
ldr r0, =PIO_OER
ldr r1, =0x40000
str r1, [r0]
loop:
ldr r0, =PIO_SODR
ldr r1, =0x40000
str r1, [r0]
mov r4, #0x300
1:
subs r4, #1
bne 1b
ldr r0, =PIO_CODR
ldr r1, =0x40000
str r1, [r0]
mov r4, #0x300
1:
subs r4, #1
bne 1b
b loop
.end
main.ld
MEMORY {
ROM : ORIGIN = 0x00100000, LENGTH = 64K
}
SECTIONS {
.text : {
*(.text*)
} > ROM
}
Makefile
all: main.bin main.o: main.s arm-none-eabi-as main.s -o main.o main.bin: main.o main.ld arm-none-eabi-ld main.o -T main.ld -o main.elf arm-none-eabi-objdump -D main.elf > main.list arm-none-eabi-objcopy main.elf main.bin -O binary clean: rm -f *.bin *.o *.elf *.list
完成
