在线时间716 小时
UID3469866
注册时间2018-4-19
NXP金币3653

TA的每日心情 | 慵懒 2025-5-7 08:45 |
---|
签到天数: 279 天 连续签到: 1 天 [LV.8]以坛为家I
版主
  
- 积分
- 10946

- 最后登录
- 2025-7-25
|
本帖最后由 az158 于 2024-1-21 11:19 编辑
行走单片机届,怎么能避开keil的RTE开发,今天咱们就来耍一耍。
新建工程,选择芯片
配置RTE文件,按下图配置就行
配置工程
- NDEBUG, CPU_MCXN947VDF_cm33_core0, MCUXPRESSO_SDK
复制代码
- -fno-common -fdata-sections -ffreestanding -fno-builtin -mthumb
复制代码
- CPU_LPC55S69JBD100_cm33_core0, NDEBUG, KEIL, NDEBUG
复制代码
- --remove --entry=Reset_Handler
- --remove
复制代码
修改pin_mux.c文件,加入初始化IO代码(正式开发这里使用MCUXpresso Config Tools配置比较爽)
- CLOCK_EnableClock(kCLOCK_Port3);
- const port_pin_config_t port3_4_pinF14_config = {/* Internal pull-up/down resistor is disabled */
- kPORT_PullDisable,
- /* Low internal pull resistor value is selected. */
- kPORT_LowPullResistor,
- /* Fast slew rate is configured */
- kPORT_FastSlewRate,
- /* Passive input filter is disabled */
- kPORT_PassiveFilterDisable,
- /* Open drain output is disabled */
- kPORT_OpenDrainDisable,
- /* Low drive strength is configured */
- kPORT_LowDriveStrength,
- /* Pin is configured as PIO3_4 */
- kPORT_MuxAlt0,
- /* Digital input enabled */
- kPORT_InputBufferEnable,
- /* Digital input is not inverted */
- kPORT_InputNormal,
- /* Pin Control Register fields [15:0] are not locked */
- kPORT_UnlockRegister};
- /* PORT3_4 (pin F14) is configured as PIO3_4 */
- PORT_SetPinConfig(PORT3, 4U, &port3_4_pinF14_config);
复制代码
新建并添加main.c文件
- #include "fsl_device_registers.h"
- #include "pin_mux.h"
- #include "board.h"
- #include "fsl_common.h"
- /*******************************************************************************
- * Variables
- ******************************************************************************/
- volatile uint32_t g_systickCounter;
- /*******************************************************************************
- * Code
- ******************************************************************************/
- void SysTick_Handler(void)
- {
- if (g_systickCounter != 0U)
- {
- g_systickCounter--;
- }
- }
- void SysTick_DelayTicks(uint32_t n)
- {
- g_systickCounter = n;
- while (g_systickCounter != 0U)
- {
- }
- }
- int main(void)
- {
- BOARD_InitPins();
- BOARD_InitBootClocks();
- CLOCK_EnableClock(kCLOCK_Gpio3);
- LED_RED_INIT(LOGIC_LED_OFF);
-
- if (SysTick_Config(SystemCoreClock / 1000U))
- {
- while (1)
- {
- }
- }
- while (1)
- {
- SysTick_DelayTicks(1000U);
- GPIO_PortToggle(BOARD_LED_RED_GPIO, 1u << BOARD_LED_RED_GPIO_PIN);
- }
- }
复制代码
整体工程如下
编译下载看看

小灯正常闪烁。
|
|