【目的】
# 模块名_DIR 是上一层传递下来的参数,
# 是从工程根目录到该模块文件夹的路径
# 向 C_SOURCES 中添加需要编译的源文件
C_SOURCES += $(wildcard $(Libraries_DIR)/CW32L083_StdLib/src/*.c)
# 向 C_INCLUDES 中添加头文件路径
C_INCLUDES += -I$(Libraries_DIR)/CMSIS/Include
C_INCLUDES += -I$(Libraries_DIR)/CMSIS/Device/
C_INCLUDES += -I$(Libraries_DIR)/CW32L083_StdLib/inc
# 向 LIBDIR 中添加静态库文件路径
# LIBDIR += -L$(Libraries_DIR)/Lib
# 向 LIBS 中添加需要链接的静态库
# LIBS += -lxxxx
# link script
LDSCRIPT = $(Libraries_DIR)/CMSIS/Device/CW32L083_FLASH.ld
# 汇编文件宏定义
AS_DEFS +=
# 汇编头文件目录
AS_INCLUDES +=
# 汇编源文件(starup)
ASM_SOURCES += $(Libraries_DIR)/CMSIS/Device/startup_cw32l083_gcc.s
#######################################
# 编译器指定
#######################################
PREFIX = arm-none-eabi-
# 启用下一项以指定GCC目录
GCC_PATH = /Applications/ARM/bin/
pack: ./Debug/WHXY.CW32L083_DFP.1.0.8.pack
target_override: CW32L083vc
frequency: 24000000
/* Specify the memory areas */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 24K
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K
}
Libraries/CW32L083_StdLib/inc/cw32l083_gtim.h:272:52: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
272 | #define IS_GTIM_DMA(DMA) (((DMA) & 0xFFFFFFC0 == 0x0UL) && (DMA) != 0x0UL)
[LD] build_exec/template.elf
[HEX] build_exec/template.elf -> build_exec/template.hex
[BIN] build_exec/template.elf -> build_exec/template.bin
[DUMP] build_exec/template.elf -> build_exec/template.s
[SIZE] build_exec/template.elf
text data bss dec hex filename
1088 16 1568 2672 a70 build_exec/template.elf
-e Build Finish
#include "app_main.h"
#include "cw32l083_gpio.h"
#include "cw32l083_rcc.h"
static inline void LED_Init()
{
GPIO_InitTypeDef GPIO_InitStruct;
RCC_AHBPeriphClk_Enable(RCC_AHB_PERIPH_GPIOC, ENABLE);
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.IT = GPIO_IT_NONE;
GPIO_InitStruct.Pins = GPIO_PIN_2;
GPIO_Init(CW_GPIOC, &GPIO_InitStruct);
}
int main(void)
{
LED_Init();
// 开启两线调试接口
RCC_SWDIO_Config(RCC_SYSCTRL_SWDIOEN);
while (1)
{
GPIO_TogglePin(CW_GPIOC, GPIO_PIN_2);
FirmwareDelay(1000000);
}
return 0;
}
/******************************************************************************
* EOF (not truncated)
******************************************************************************/
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t *file, uint32_t line)
{
/* USER CODE BEGIN 6 */
/* User can add his own implementation to report the file name and line number,
tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */
liujianhuadeMacBook-Pro:cw32l083_gcc liujianhua$ make flash
-e Start pyOCD
0000909 I Loading /Users/liujianhua/cw32l083/cw32l083_gcc/build_exec/template.elf [load_cmd]
[==================================================] 100%
0001522 I Erased 0 bytes (0 sectors), programmed 0 bytes (0 pages), skipped 1536 bytes (3 pages) at 2.45 kB/s [loader]