You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/08/24 18:56:14 UTC
[13/14] incubator-mynewt-core git commit: olimex_stm32;
create uart0 os device in bsp_init().
olimex_stm32; create uart0 os device in bsp_init().
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/6535f447
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/6535f447
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/6535f447
Branch: refs/heads/sterly_refactor
Commit: 6535f4471c03ccb3d9172df7de7e34329db1b3db
Parents: 11eb7f5
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Wed Aug 24 11:46:08 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Wed Aug 24 11:46:08 2016 -0700
----------------------------------------------------------------------
.../include/bsp/bsp.h | 3 ++-
hw/bsp/olimex_stm32-e407_devboard/pkg.yml | 1 +
hw/bsp/olimex_stm32-e407_devboard/src/os_bsp.c | 21 +++++++++++++++++++-
3 files changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6535f447/hw/bsp/olimex_stm32-e407_devboard/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/olimex_stm32-e407_devboard/include/bsp/bsp.h b/hw/bsp/olimex_stm32-e407_devboard/include/bsp/bsp.h
index 7751025..6600816 100644
--- a/hw/bsp/olimex_stm32-e407_devboard/include/bsp/bsp.h
+++ b/hw/bsp/olimex_stm32-e407_devboard/include/bsp/bsp.h
@@ -44,7 +44,8 @@ extern uint8_t _ccram_start;
/* UART */
#define UART_CNT 1
-#define CONSOLE_UART 0
+#define CONSOLE_UART "uart0"
+#define CONSOLE_UART_SPEED 115200
#define NFFS_AREA_MAX (8)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6535f447/hw/bsp/olimex_stm32-e407_devboard/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/olimex_stm32-e407_devboard/pkg.yml b/hw/bsp/olimex_stm32-e407_devboard/pkg.yml
index 983e616..761d9ba 100644
--- a/hw/bsp/olimex_stm32-e407_devboard/pkg.yml
+++ b/hw/bsp/olimex_stm32-e407_devboard/pkg.yml
@@ -37,3 +37,4 @@ pkg.cflags: -DSTM32F407xx
pkg.deps:
- hw/mcu/stm/stm32f4xx
- libs/baselibc
+ - drivers/uart/uart_hal
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6535f447/hw/bsp/olimex_stm32-e407_devboard/src/os_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/olimex_stm32-e407_devboard/src/os_bsp.c b/hw/bsp/olimex_stm32-e407_devboard/src/os_bsp.c
index f2fe9e1..ec71236 100644
--- a/hw/bsp/olimex_stm32-e407_devboard/src/os_bsp.c
+++ b/hw/bsp/olimex_stm32-e407_devboard/src/os_bsp.c
@@ -6,7 +6,7 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
@@ -20,9 +20,17 @@
/*
* XXXX for now have this here.
*/
+#include <assert.h>
+
#include <hal/flash_map.h>
#include <hal/hal_bsp.h>
+#include <os/os_dev.h>
+#include <uart/uart.h>
+#include <uart_hal/uart_hal.h>
+
+#include "bsp/bsp.h"
+
static struct flash_area bsp_flash_areas[] = {
[FLASH_AREA_BOOTLOADER] = {
.fa_flash_id = 0, /* internal flash */
@@ -51,6 +59,11 @@ static struct flash_area bsp_flash_areas[] = {
.fa_size = (32 * 1024)
}
};
+static struct uart_dev hal_uart0;
+
+/* XXX should not be here */
+struct stm32f4_uart_cfg;
+extern struct stm32f4_uart_cfg *bsp_uart_config(int port);
void _close(int fd);
@@ -71,6 +84,8 @@ bsp_imgr_current_slot(void)
void
bsp_init(void)
{
+ int rc;
+
/*
* XXX this reference is here to keep this function in.
*/
@@ -78,5 +93,9 @@ bsp_init(void)
_close(0);
flash_area_init(bsp_flash_areas,
sizeof(bsp_flash_areas) / sizeof(bsp_flash_areas[0]));
+
+ rc = os_dev_create((struct os_dev *) &hal_uart0, CONSOLE_UART,
+ OS_DEV_INIT_PRIMARY, 0, uart_hal_init, (void *)bsp_uart_config(0));
+ assert(rc == 0);
}