[bsp][stm32] optimize main func

This commit is contained in:
SummerGift 2018-12-20 14:53:46 +08:00
parent d5c7d8d41f
commit 938bbb030d
27 changed files with 91 additions and 161 deletions

View File

@ -11,14 +11,23 @@
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
#include "drv_gpio.h"
/* defined the LED0 pin: PB1 */
#define LED0_PIN GET_PIN(B, 1)
int main(void)
{
int count = 1;
/* set LED0 pin mode to output */
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
while (count++)
{
// rt_pin_write(LED0_PIN, !rt_pin_read(LED0_PIN));
rt_pin_write(LED0_PIN, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(LED0_PIN, PIN_LOW);
rt_thread_mdelay(500);
}
return RT_EOK;
}

View File

@ -51,12 +51,3 @@ void MX_GPIO_Init(void)
__HAL_RCC_GPIOA_CLK_ENABLE();
}
#ifdef RT_USING_PIN
// int board_pin_init(void)
// {
// rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
// return 0;
// }
// INIT_BOARD_EXPORT(board_pin_init);
#endif /* RT_USING_PIN */

View File

@ -15,12 +15,6 @@
#include <stm32f1xx.h>
#include "drv_common.h"
#ifdef BSP_USING_GPIO
#include "drv_gpio.h"
/* Board Pin definitions */
// #define LED0_PIN GET_PIN(C, 0)
#endif
/* Internal SRAM memory size[Kbytes] <8-64>, Default: 64*/
#define STM32_SRAM_SIZE 20
#define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024)

View File

@ -11,14 +11,23 @@
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
#include "drv_gpio.h"
/* defined the LED0 pin: PB1 */
#define LED0_PIN GET_PIN(B, 1)
int main(void)
{
int count = 1;
/* set LED0 pin mode to output */
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
while (count++)
{
// rt_pin_write(LED0_PIN, !rt_pin_read(LED0_PIN));
rt_pin_write(LED0_PIN, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(LED0_PIN, PIN_LOW);
rt_thread_mdelay(500);
}
return RT_EOK;
}

View File

@ -56,12 +56,3 @@ void MX_GPIO_Init(void)
__HAL_RCC_GPIOA_CLK_ENABLE();
}
#ifdef RT_USING_PIN
// int board_pin_init(void)
// {
// rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
// return 0;
// }
// INIT_BOARD_EXPORT(board_pin_init);
#endif /* RT_USING_PIN */

View File

@ -15,12 +15,6 @@
#include <stm32f4xx.h>
#include "drv_common.h"
#ifdef BSP_USING_GPIO
#include "drv_gpio.h"
/* Board Pin definitions */
// #define LED0_PIN GET_PIN(C, 0)
#endif
#define STM32_SRAM_SIZE 128
#define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024)

View File

@ -11,14 +11,23 @@
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
#include "drv_gpio.h"
/* defined the LED0 pin: PB1 */
#define LED0_PIN GET_PIN(B, 1)
int main(void)
{
int count = 1;
/* set LED0 pin mode to output */
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
while (count++)
{
// rt_pin_write(LED0_PIN, !rt_pin_read(LED0_PIN));
rt_pin_write(LED0_PIN, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(LED0_PIN, PIN_LOW);
rt_thread_mdelay(500);
}
return RT_EOK;
}

View File

@ -66,12 +66,3 @@ void MX_GPIO_Init(void)
__HAL_RCC_GPIOA_CLK_ENABLE();
}
#ifdef RT_USING_PIN
// int board_pin_init(void)
// {
// rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
// return 0;
// }
// INIT_BOARD_EXPORT(board_pin_init);
#endif /* RT_USING_PIN */

View File

@ -15,12 +15,6 @@
#include <stm32l4xx.h>
#include "drv_common.h"
#ifdef BSP_USING_GPIO
#include "drv_gpio.h"
/* Board Pin definitions */
// #define LED0_PIN GET_PIN(C, 0)
#endif
#define STM32_SRAM_SIZE 96
#define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024)

View File

@ -11,14 +11,23 @@
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
#include "drv_gpio.h"
/* defined the LED0 pin: PC0 */
#define LED0_PIN GET_PIN(C, 0)
int main(void)
{
int count = 1;
/* set LED0 pin mode to output */
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
while (count++)
{
rt_pin_write(LED0_PIN, !rt_pin_read(LED0_PIN));
rt_pin_write(LED0_PIN, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(LED0_PIN, PIN_LOW);
rt_thread_mdelay(500);
}
return RT_EOK;
}

View File

@ -62,11 +62,4 @@ void MX_GPIO_Init(void)
__HAL_RCC_GPIOA_CLK_ENABLE();
}
#ifdef RT_USING_PIN
int board_pin_init(void)
{
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
return 0;
}
INIT_BOARD_EXPORT(board_pin_init);
#endif /* RT_USING_PIN */

View File

@ -15,13 +15,6 @@
#include <stm32f1xx.h>
#include "drv_common.h"
#ifdef BSP_USING_GPIO
#include "drv_gpio.h"
/* Board Pin definitions */
#define LED0_PIN GET_PIN(C, 0)
#define LED1_PIN GET_PIN(C, 1)
#endif
#define STM32_FLASH_START_ADRESS ((uint32_t)0x08000000)
#define STM32_FLASH_SIZE (128 * 1024)
#define STM32_FLASH_END_ADDRESS ((uint32_t)(STM32_FLASH_START_ADRESS + STM32_FLASH_SIZE))

View File

@ -11,14 +11,23 @@
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
#include "drv_gpio.h"
/* defined the LED0 pin: PF7 */
#define LED0_PIN GET_PIN(F, 7)
int main(void)
{
int count = 1;
/* set LED0 pin mode to output */
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
while (count++)
{
rt_pin_write(LED0_PIN, !rt_pin_read(LED0_PIN));
rt_pin_write(LED0_PIN, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(LED0_PIN, PIN_LOW);
rt_thread_mdelay(500);
}
return RT_EOK;
}

View File

@ -63,14 +63,3 @@ void MX_GPIO_Init(void)
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
}
#ifdef RT_USING_PIN
int board_pin_init(void)
{
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);
return 0;
}
INIT_BOARD_EXPORT(board_pin_init);
#endif /* RT_USING_PIN */

View File

@ -15,13 +15,6 @@
#include <stm32f1xx.h>
#include "drv_common.h"
#ifdef BSP_USING_GPIO
#include "drv_gpio.h"
/* Board Pin definitions */
#define LED0_PIN GET_PIN(F, 7)
#define LED1_PIN GET_PIN(F, 8)
#endif
/* Internal SRAM memory size[Kbytes] <8-64>, Default: 64*/
#define STM32_SRAM_SIZE 64
#define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024)

View File

@ -12,14 +12,23 @@
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
#include "drv_gpio.h"
/* defined the LED0 pin: PF9 */
#define LED0_PIN GET_PIN(F, 9)
int main(void)
{
int count = 1;
/* set LED0 pin mode to output */
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
while (count++)
{
rt_pin_write(LED1_PIN, !rt_pin_read(LED1_PIN));
rt_pin_write(LED0_PIN, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(LED0_PIN, PIN_LOW);
rt_thread_mdelay(500);
}
return RT_EOK;
}

View File

@ -67,14 +67,3 @@ void MX_GPIO_Init(void)
__HAL_RCC_GPIOB_CLK_ENABLE();
}
#ifdef RT_USING_PIN
int board_pin_init(void)
{
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);
return 0;
}
INIT_BOARD_EXPORT(board_pin_init);
#endif /* RT_USING_PIN */

View File

@ -15,13 +15,6 @@
#include <stm32f4xx.h>
#include "drv_common.h"
#ifdef BSP_USING_GPIO
#include "drv_gpio.h"
/* Board Pin definitions */
#define LED0_PIN GET_PIN(F, 9)
#define LED1_PIN GET_PIN(F, 10)
#endif
#define STM32_SRAM_SIZE (128)
#define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024)

View File

@ -11,14 +11,23 @@
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
#include "drv_gpio.h"
/* defined the LED0 pin: PB1 */
#define LED0_PIN GET_PIN(B, 1)
int main(void)
{
int count = 1;
/* set LED0 pin mode to output */
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
while (count++)
{
rt_pin_write(LED1_PIN, !rt_pin_read(LED1_PIN));
rt_pin_write(LED0_PIN, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(LED0_PIN, PIN_LOW);
rt_thread_mdelay(500);
}
return RT_EOK;
}

View File

@ -77,14 +77,3 @@ void MX_GPIO_Init(void)
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();
}
#ifdef RT_USING_PIN
int board_pin_init(void)
{
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);
return 0;
}
INIT_BOARD_EXPORT(board_pin_init);
#endif /* RT_USING_PIN */

View File

@ -15,10 +15,6 @@
#include <stm32f4xx.h>
#include "drv_common.h"
#ifdef BSP_USING_GPIO
#include "drv_gpio.h"
#endif
#define STM32_SRAM_SIZE (192)
#define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024)
@ -39,12 +35,7 @@ extern int __bss_end;
#define HEAP_END STM32_SRAM_END
/* Board Pin definitions */
#define LED0_PIN GET_PIN(B, 1)
#define LED1_PIN GET_PIN(B, 0)
void SystemClock_Config(void);
void MX_GPIO_Init(void);
#endif

View File

@ -12,14 +12,23 @@
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
#include "drv_gpio.h"
/* defined the LED0 pin: PH10 */
#define LED0_PIN GET_PIN(H, 10)
int main(void)
{
int count = 1;
/* set LED0 pin mode to output */
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
while (count++)
{
rt_pin_write(LED1_PIN, !rt_pin_read(LED1_PIN));
rt_pin_write(LED0_PIN, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(LED0_PIN, PIN_LOW);
rt_thread_mdelay(500);
}
return RT_EOK;
}

View File

@ -76,14 +76,3 @@ void MX_GPIO_Init(void)
__HAL_RCC_GPIOG_CLK_ENABLE();
}
#ifdef RT_USING_PIN
int board_pin_init(void)
{
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);
return 0;
}
INIT_BOARD_EXPORT(board_pin_init);
#endif /* RT_USING_PIN */

View File

@ -15,10 +15,6 @@
#include <stm32f4xx.h>
#include "drv_common.h"
#ifdef BSP_USING_GPIO
#include "drv_gpio.h"
#endif
#define STM32_SRAM_SIZE (192)
#define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024)
@ -39,10 +35,6 @@ extern int __bss_end;
#define HEAP_END STM32_SRAM_END
/* Board Pin definitions */
#define LED0_PIN GET_PIN(H, 10)
#define LED1_PIN GET_PIN(H, 11)
void SystemClock_Config(void);
void MX_GPIO_Init(void);

View File

@ -11,14 +11,23 @@
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
#include "drv_gpio.h"
/* defined the LED0 pin: PE7 */
#define LED0_PIN GET_PIN(E, 7)
int main(void)
{
int count = 1;
/* set LED0 pin mode to output */
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
while (count++)
{
rt_pin_write(LED0_PIN, !rt_pin_read(LED0_PIN));
rt_pin_write(LED0_PIN, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(LED0_PIN, PIN_LOW);
rt_thread_mdelay(500);
}
return RT_EOK;
}

View File

@ -74,12 +74,3 @@ void MX_GPIO_Init(void)
__HAL_RCC_GPIOB_CLK_ENABLE();
}
#ifdef RT_USING_PIN
int board_pin_init(void)
{
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
return 0;
}
INIT_BOARD_EXPORT(board_pin_init);
#endif /* RT_USING_PIN */

View File

@ -15,10 +15,6 @@
#include <stm32l4xx.h>
#include "drv_common.h"
#ifdef BSP_USING_GPIO
#include "drv_gpio.h"
#endif
#define STM32_SRAM1_SIZE (96)
#define STM32_SRAM1_START (0x20000000)
#define STM32_SRAM1_END (STM32_SRAM1_START + STM32_SRAM1_SIZE * 1024)
@ -30,10 +26,6 @@
#define HEAP_BEGIN STM32_SRAM1_START
#define HEAP_END STM32_SRAM1_END
/* Board Pin definitions */
#define LED0_PIN GET_PIN(E, 7)
#define LED1_PIN GET_PIN(E, 8)
void SystemClock_Config(void);
void MX_GPIO_Init(void);