Steward
分享是一種喜悅、更是一種幸福
微處理器 - STMicroelectronics STM8S103 - Assembly - LED
表格
main.s
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | . equ PB_ODR , 0x5005 . equ PB_IDR , 0x5006 . equ PB_DDR , 0x5007 . equ PB_CR1 , 0x5008 . equ PB_CR2 , 0x5009 . area data . area sseg . area home int main . area cseg main : mov PB_DDR , #0x20 mov PB_CR1 , #0x20 loop : ld a , PB_ODR xor a , #0x20 ld PB_ODR , a ldw x , #30000 d0 : decw x jrne d0 jp loop |
編譯、燒錄
$ sdasstm8 -o main.s $ sdldstm8 -ni -b home=0x8000 -b cseg=0x8080 -b data=0x0001 -b sseg=0xffff main.rel $ sudo stm8flash -c stlinkv2 -p stm8s103f3 -u Determine OPT area Due to its file extension (or lack thereof), "Workaround" is considered as RAW BINARY format! Unlocked device. Option bytes reset to default state. Bytes written: 11 $ sudo stm8flash -c stlinkv2 -p stm8s103f3 -s flash -w main.ihx Determine FLASH area Due to its file extension (or lack thereof), "main.ihx" is considered as INTEL HEX format! 154 bytes at 0x8000... OK Bytes written: 154
完成