主题中讨论的其他器件:MSPM0G3507
好了、只需设置我的构建环境即可。 因此、第一个使 LED 闪烁的程序很简单:
#include "ti_msp_dl_config.h"
#include "ti/devices/msp/m0p/mspm0g350x.h"
#include "ti/devices/msp/peripherals/hw_gpio.h"
int main(void) {
GPIO_Regs *GPIOA=(GPIO_Regs *)GPIOA_BASE; // set up point to GPIO A
GPIOA->DOE31_0 |= 1; // enable PA0
while (1) {
for (int i=0; i<100000; i++); // pause
GPIOA->DOUT31_0 ^= 1; // toggle PA0
}
}
使用 objdump–x 快速查看、编译的代码看起来像是它设置了正确的中断等
arm-none-eabi-objdump -x gcc/pwm_led_driver.out
gcc/pwm_led_driver.out: file format elf32-littlearm
gcc/pwm_led_driver.out
architecture: armv6s-m, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x000000c0
Program Header:
LOAD off 0x00001000 vaddr 0x00000000 paddr 0x00000000 align 2**12
filesz 0x000001b8 memsz 0x000001b8 flags r-x
LOAD off 0x00002000 vaddr 0x20200000 paddr 0x000001b8 align 2**12
filesz 0x00000000 memsz 0x00000000 flags rw-
LOAD off 0x00000000 vaddr 0x20200000 paddr 0x20200000 align 2**12
filesz 0x00000000 memsz 0x00000000 flags rw-
private flags = 0x5000200: [Version5 EABI] [soft-float ABI]
Sections:
Idx Name Size VMA LMA File off Algn
0 .intvecs 000000c0 00000000 00000000 00001000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
1 .text 000000f8 000000c0 000000c0 000010c0 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .ramfunc 00000000 20200000 20200000 00002000 2**0
CONTENTS
3 .rodata 00000000 000001b8 000001b8 00002000 2**0
CONTENTS, ALLOC, LOAD, DATA
4 .ARM.extab 00000000 000001b8 000001b8 00002000 2**0
CONTENTS
5 .data 00000000 20200000 000001b8 00002000 2**0
CONTENTS, ALLOC, LOAD, DATA
6 .bss 00000000 20200000 000001b8 00002000 2**0
ALLOC
7 .debug_info 0001c956 00000000 00000000 00002000 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
8 .debug_abbrev 00000bb8 00000000 00000000 0001e956 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
9 .debug_aranges 00000268 00000000 00000000 0001f50e 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
10 .debug_rnglists 000000b8 00000000 00000000 0001f776 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
11 .debug_line 00002b9d 00000000 00000000 0001f82e 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
12 .debug_str 00003b1f 00000000 00000000 000223cb 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
13 .comment 00000097 00000000 00000000 00025eea 2**0
CONTENTS, READONLY
14 .ARM.attributes 0000002c 00000000 00000000 00025f81 2**0
CONTENTS, READONLY
15 .debug_frame 00000670 00000000 00000000 00025fb0 2**2
CONTENTS, READONLY, DEBUGGING, OCTETS
16 .debug_ranges 00000688 00000000 00000000 00026620 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
17 .debug_loc 000023d6 00000000 00000000 00026ca8 2**0
CONTENTS, READONLY, DEBUGGING, OCTETS
SYMBOL TABLE:
00000000 l d .intvecs 00000000 .intvecs
000000c0 l d .text 00000000 .text
20200000 l d .ramfunc 00000000 .ramfunc
000001b8 l d .rodata 00000000 .rodata
000001b8 l d .ARM.extab 00000000 .ARM.extab
20200000 l d .data 00000000 .data
20200000 l d .bss 00000000 .bss
00000000 l d .debug_info 00000000 .debug_info
00000000 l d .debug_abbrev 00000000 .debug_abbrev
00000000 l d .debug_aranges 00000000 .debug_aranges
00000000 l d .debug_rnglists 00000000 .debug_rnglists
00000000 l d .debug_line 00000000 .debug_line
00000000 l d .debug_str 00000000 .debug_str
00000000 l d .comment 00000000 .comment
00000000 l d .ARM.attributes 00000000 .ARM.attributes
00000000 l d .debug_frame 00000000 .debug_frame
00000000 l d .debug_ranges 00000000 .debug_ranges
00000000 l d .debug_loc 00000000 .debug_loc
00000000 l df *ABS* 00000000 startup_mspm0g3507_gcc.c
00000000 l df *ABS* 00000000 pwm_led_driver.c
00000000 l df *ABS* 00000000 ti_msp_dl_config.c
00000000 l df *ABS* 00000000 dl_common.c
00000000 l df *ABS* 00000000 dl_timer.c
000001ac w F .text 00000008 TIMG6_IRQHandler
000001ac w F .text 00000008 TIMG8_IRQHandler
20200000 g .data 00000000 __data_start__
000001ac w F .text 00000008 I2C0_IRQHandler
000001ac w F .text 00000008 HardFault_Handler
00000080 g *ABS* 00000000 _Min_Stack_Size
000001ac w F .text 00000008 SysTick_Handler
000001ac w F .text 00000008 PendSV_Handler
000001ac w F .text 00000008 NMI_Handler
000001b8 g .ARM.extab 00000000 __exidx_end
000001ac w F .text 00000008 I2C1_IRQHandler
000001ac w F .text 00000008 UART1_IRQHandler
000001b8 g .text 00000000 __etext
000001ac w F .text 00000008 TIMA1_IRQHandler
20200000 g *ABS* 00000000 _vtable_base_address
000001ac w F .text 00000008 UART0_IRQHandler
000001ac w F .text 00000008 ADC0_IRQHandler
20200000 g .debug_info 00000000 __HeapLimit
20200000 g .debug_info 00000000 __heap_end__
20200000 g .bss 00000000 __bss_start__
000001ac w F .text 00000008 SPI1_IRQHandler
000001b8 g .ARM.extab 00000000 __exidx_start
000001ac w F .text 00000008 TIMG0_IRQHandler
000001ac w F .text 00000008 ADC1_IRQHandler
000001ac w F .text 00000008 GROUP1_IRQHandler
000001ac w F .text 00000008 RTC_IRQHandler
00000114 w F .text 00000098 Reset_Handler
000001ac w F .text 00000008 GROUP0_IRQHandler
20200000 g .debug_info 00000000 end
000001ac w F .text 00000008 UART2_IRQHandler
20200000 g .data 00000000 __data_end__
20200000 g .bss 00000000 __bss_end__
00000000 g *ABS* 00000000 _Min_Heap_Size
000001ac g F .text 00000008 Default_Handler
20200000 g .debug_info 00000000 __end
000001b8 g *ABS* 00000000 __data_load__
000000c0 g F .text 00000054 main
000001b8 g *ABS* 00000000 __ramfunct_load__
000001ac w F .text 00000008 SVC_Handler
000001b8 g .text 00000000 __init_array_end
20200000 g .debug_info 00000000 __heap_start__
000001ac w F .text 00000008 TIMG12_IRQHandler
20200000 g .ramfunc 00000000 __ramfunct_end__
000001ac w F .text 00000008 DAC0_IRQHandler
20208000 g .bss 00000000 __StackTop
000001ac w F .text 00000008 TIMG7_IRQHandler
000001ac w F .text 00000008 SPI0_IRQHandler
20200000 g .ramfunc 00000000 __ramfunct_start__
20200000 g .debug_info 00000000 _end
000001ac w F .text 00000008 AES_IRQHandler
00000000 g O .intvecs 000000c0 interruptVectors
000001ac w F .text 00000008 DMA_IRQHandler
000001b8 g .text 00000000 __init_array_start
000001ac w F .text 00000008 TIMA0_IRQHandler
20200000 g .debug_info 00000000 _stack
000001ac w F .text 00000008 UART3_IRQHandler
00000000 g *ABS* 00000000 _intvecs_base_address
000001ac w F .text 00000008 CANFD0_IRQHandler
但是 LED 不闪烁,并且尝试|= 1和&=~1(例如开和关)也不工作。 所以,像往常一样,我必须做一些简单的错误! 有什么想法吗?

