RTT第一个工程

第一个RTT工程

1. 配置工程

选择芯片STM32F103C8(其包含该芯片的Flash及SRAM介绍);

Jlink  SW模式

output->Debug info/Browse info,可以直接定位函数和变量。

2. 修改LED相关GPIO。

3. 核对串口。

RTConfig.h中定义串口终端RT_CONSOLE_DEVICE_NAME “uart1”

Drivers/uarst.c中定义串口1 GPIO和baud。

4. 晶振。定义在STM32f10x_conf.h,定义外部晶振8MHz。

因为是具体板卡,不熟悉其他宏,则可直接提取频率代码,使其一定执行。

5. 配置Lib。有时编译不成功要在工程配置中选择Use MicroLib。

6. 确认Flash,SRAM大小。board.h中定义(因与具体板卡有关,所以定义在board.h中)。

注:board.h中定义与本板卡相关的配置,与本板卡相关的配置可修改此处。

/*
 * File      : board.h
 * This file is part of RT-Thread RTOS
 * COPYRIGHT (C) 2009, RT-Thread Development Team
 *
 * The license and distribution terms for this file may be
 * found in the file LICENSE in this distribution or at
 * http://www.rt-thread.org/license/LICENSE
 *
 * Change Logs:
 * Date           Author       Notes
 * 2009-09-22     Bernard      add board.h to this bsp
 */

// <<< Use Configuration Wizard in Context Menu >>>
#ifndef __BOARD_H__
#define __BOARD_H__

#include "stm32f10x.h"

/* board configuration */

/* whether use board external SRAM memory */
// <e>Use external SRAM memory on the board
//     <i>Enable External SRAM memory
#define STM32_EXT_SRAM          0
//    <o>Begin Address of External SRAM
//        <i>Default: 0x68000000
#define STM32_EXT_SRAM_BEGIN    0x68000000 /* the begining address of external SRAM */
//    <o>End Address of External SRAM
//        <i>Default: 0x68080000
#define STM32_EXT_SRAM_END      0x68080000 /* the end address of external SRAM */
// </e>

// <o> Internal SRAM memory size[Kbytes] <8-64>
//    <i>Default: 64
#define STM32_SRAM_SIZE         20
#define STM32_SRAM_END          (0x20000000 + STM32_SRAM_SIZE * 1024)

// <<< Use Configuration Wizard in Context Menu >>>

/* USART driver select. */
#define RT_USING_UART1
#define RT_USING_UART2
#define RT_USING_UART3
#define USING_BXCAN1

void rt_hw_board_init(void);

#endif /* __BOARD_H__ */
原文地址:https://www.cnblogs.com/embedded-linux/p/5450153.html