You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2016/09/23 04:10:19 UTC

[1/2] incubator-mynewt-core git commit: Get the 16K bsp looking like the nrf51dk bsp (except for the additional RAM).

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop 063a01b4f -> dfd03160d


Get the 16K bsp looking like the nrf51dk bsp (except for the additional RAM).


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/dfd03160
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/dfd03160
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/dfd03160

Branch: refs/heads/develop
Commit: dfd03160d59ecbd2c6b25a6529051589facea961
Parents: 6512e62
Author: William San Filippo <wi...@runtime.io>
Authored: Thu Sep 22 21:09:15 2016 -0700
Committer: William San Filippo <wi...@runtime.io>
Committed: Thu Sep 22 21:10:14 2016 -0700

----------------------------------------------------------------------
 hw/bsp/nrf51dk-16kbram/include/bsp/bsp.h |  5 ++-
 hw/bsp/nrf51dk-16kbram/pkg.yml           | 35 +++++++++---------
 hw/bsp/nrf51dk-16kbram/src/os_bsp.c      | 52 ++++++++++++++++++---------
 hw/bsp/nrf51dk/pkg.yml                   |  3 ++
 4 files changed, 62 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/dfd03160/hw/bsp/nrf51dk-16kbram/include/bsp/bsp.h
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk-16kbram/include/bsp/bsp.h b/hw/bsp/nrf51dk-16kbram/include/bsp/bsp.h
index 7f6c8e7..9309cbe 100644
--- a/hw/bsp/nrf51dk-16kbram/include/bsp/bsp.h
+++ b/hw/bsp/nrf51dk-16kbram/include/bsp/bsp.h
@@ -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,
@@ -39,6 +39,9 @@ extern uint8_t _ram_start;
 /* LED pins */
 #define LED_BLINK_PIN   (21)
 
+/* SPI SS */
+#define SPI_SS_PIN      (24)
+
 /* UART info */
 #define CONSOLE_UART            "uart0"
 #define CONSOLE_UART_SPEED      115200

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/dfd03160/hw/bsp/nrf51dk-16kbram/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk-16kbram/pkg.yml b/hw/bsp/nrf51dk-16kbram/pkg.yml
index 991c55c..d65887d 100644
--- a/hw/bsp/nrf51dk-16kbram/pkg.yml
+++ b/hw/bsp/nrf51dk-16kbram/pkg.yml
@@ -34,8 +34,8 @@ pkg.part2linkerscript: "split-nrf51dk-16kbram.ld"
 pkg.downloadscript: nrf51dk-16kbram_download.sh
 pkg.debugscript: nrf51dk-16kbram_debug.sh
 pkg.cflags:
-    # Nordic SDK files require these defines.
-    - '-DNRF52'
+    # Nordic SDK files require this define.
+    - '-DNRF51'
 
 pkg.deps:
     - hw/mcu/nordic/nrf51xxx
@@ -60,7 +60,7 @@ pkg.syscfg_defs:
 
     CLOCK_FREQ:
         description: 'TBD'
-        value:  1000000
+        value: 1000000
 
     XTAL_32768:
         description: 'TBD'
@@ -68,27 +68,30 @@ pkg.syscfg_defs:
 
     ADC_0:
         description: 'TBD'
-        value:  0
-    ADC_0_RESOLUTION:
-        description: 'TBD'
-        value: 'SAADC_CONFIG_RESOLUTION'
-    ADC_0_OVERSAMPLE:
-        description: 'TBD'
-        value: 'SAADC_CONFIG_OVERSAMPLE'
+        value: 0
     ADC_0_INTERRUPT_PRIORITY:
         description: 'TBD'
-        value: 'SAADC_CONFIG_IRQ_PRIORITY'
+        value: 'ADC_CONFIG_IRQ_PRIORITY'
 
     UART_0:
         description: 'TBD'
-        value:  1
-    UART_1:
+        value: 1
+    UART_0_PIN_TX:
+        description: 'TBD'
+        value: 9
+    UART_0_PIN_RX:
+        description: 'TBD'
+        value: 11
+    UART_0_PIN_RTS:
+        description: 'TBD'
+        value: 8
+    UART_0_PIN_CTS:
         description: 'TBD'
-        value:  0
+        value: 10
 
     SPI_MASTER:
         description: 'TBD'
-        value:  0
+        value: 0
     SPI_SLAVE:
         description: 'TBD'
-        value:  0
+        value: 0

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/dfd03160/hw/bsp/nrf51dk-16kbram/src/os_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk-16kbram/src/os_bsp.c b/hw/bsp/nrf51dk-16kbram/src/os_bsp.c
index abcf5e4..4fc35e0 100644
--- a/hw/bsp/nrf51dk-16kbram/src/os_bsp.c
+++ b/hw/bsp/nrf51dk-16kbram/src/os_bsp.c
@@ -17,17 +17,23 @@
  * under the License.
  */
 #include <assert.h>
-#include <hal/flash_map.h>
-#include <hal/hal_bsp.h>
-#include <hal/hal_spi.h>
-#ifdef BSP_CFG_SPI_MASTER
+#include "syscfg/syscfg.h"
+#include "bsp.h"
+#include "hal/flash_map.h"
+#include "hal/hal_bsp.h"
+#include "hal/hal_spi.h"
+#include "mcu/nrf51_hal.h"
+#if MYNEWT_VAL(SPI_MASTER)
 #include "nrf_drv_spi.h"
 #endif
-#ifdef BSP_CFG_SPI_SLAVE
+#if MYNEWT_VAL(SPI_SLAVE)
 #include "nrf_drv_spis.h"
 #endif
 #include "nrf_drv_config.h"
-#include <app_util_platform.h>
+#include "app_util_platform.h"
+#include "os/os_dev.h"
+#include "uart/uart.h"
+#include "uart_hal/uart_hal.h"
 
 static struct flash_area bsp_flash_areas[] = {
     [FLASH_AREA_BOOTLOADER] = {
@@ -57,6 +63,16 @@ static struct flash_area bsp_flash_areas[] = {
     }
 };
 
+#if MYNEWT_VAL(UART_0)
+static struct uart_dev os_bsp_uart0;
+static const struct nrf51_uart_cfg os_bsp_uart0_cfg = {
+    .suc_pin_tx = MYNEWT_VAL(UART_0_PIN_TX),
+    .suc_pin_rx = MYNEWT_VAL(UART_0_PIN_RX),
+    .suc_pin_rts = MYNEWT_VAL(UART_0_PIN_RTS),
+    .suc_pin_cts = MYNEWT_VAL(UART_0_PIN_CTS),
+};
+#endif
+
 void _close(int fd);
 void bsp_hal_init(void);
 
@@ -83,12 +99,20 @@ void bsp_slot_init_split_application(void) {
 void
 bsp_init(void)
 {
-#ifdef BSP_CFG_SPI_MASTER
     int rc;
+
+    (void)rc;
+
+#if MYNEWT_VAL(UART_0)
+    rc = os_dev_create((struct os_dev *) &os_bsp_uart0, "uart0",
+      OS_DEV_INIT_PRIMARY, 0, uart_hal_init, (void *)&os_bsp_uart0_cfg);
+    assert(rc == 0);
+#endif
+
+#if MYNEWT_VAL(SPI_MASTER)
     nrf_drv_spi_config_t spi_cfg = NRF_DRV_SPI_DEFAULT_CONFIG(0);
 #endif
-#ifdef BSP_CFG_SPI_SLAVE
-    int rc;
+#if MYNEWT_VAL(SPI_SLAVE)
     nrf_drv_spis_config_t spi_cfg = NRF_DRV_SPIS_DEFAULT_CONFIG(1);
 #endif
 
@@ -101,17 +125,13 @@ bsp_init(void)
     flash_area_init(bsp_flash_areas,
       sizeof(bsp_flash_areas) / sizeof(bsp_flash_areas[0]));
 
-    bsp_hal_init();
-
-#ifdef BSP_CFG_SPI_MASTER
-    /*  We initialize one SPI interface as a master. */
+#if MYNEWT_VAL(SPI_MASTER)
     rc = hal_spi_init(0, &spi_cfg, HAL_SPI_TYPE_MASTER);
     assert(rc == 0);
 #endif
 
-#ifdef BSP_CFG_SPI_SLAVE
-    /*  We initialize one SPI interface as a master. */
-    spi_cfg.csn_pin = SPIS1_CONFIG_CSN_PIN;
+#if MYNEWT_VAL(SPI_SLAVE)
+    spi_cfg.csn_pin = SPI_SS_PIN;
     spi_cfg.csn_pullup = NRF_GPIO_PIN_PULLUP;
     rc = hal_spi_init(1, &spi_cfg, HAL_SPI_TYPE_SLAVE);
     assert(rc == 0);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/dfd03160/hw/bsp/nrf51dk/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk/pkg.yml b/hw/bsp/nrf51dk/pkg.yml
index 8ad78e3..2a6dd06 100644
--- a/hw/bsp/nrf51dk/pkg.yml
+++ b/hw/bsp/nrf51dk/pkg.yml
@@ -50,6 +50,9 @@ pkg.deps.ADC_0:
 pkg.deps.UART_0:
     - drivers/uart/uart_hal
 
+pkg.deps.UART_1:
+    - drivers/uart/uart_bitbang
+
 pkg.syscfg_defs:
     BSP_NRF51:
         description: 'TBD'


[2/2] incubator-mynewt-core git commit: No jira ticket: reduce task stacks for blinky since 4K stacks not needed. Remove definition of console handler (not needed).

Posted by we...@apache.org.
No jira ticket: reduce task stacks for blinky since 4K stacks
not needed. Remove definition of console handler (not needed).


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/6512e624
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/6512e624
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/6512e624

Branch: refs/heads/develop
Commit: 6512e6244314b124b7a23a8223f68f223c80c8b7
Parents: 063a01b
Author: William San Filippo <wi...@runtime.io>
Authored: Thu Sep 22 21:02:05 2016 -0700
Committer: William San Filippo <wi...@runtime.io>
Committed: Thu Sep 22 21:10:14 2016 -0700

----------------------------------------------------------------------
 apps/blinky/src/main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6512e624/apps/blinky/src/main.c
----------------------------------------------------------------------
diff --git a/apps/blinky/src/main.c b/apps/blinky/src/main.c
index e7736c9..717bac8 100755
--- a/apps/blinky/src/main.c
+++ b/apps/blinky/src/main.c
@@ -32,18 +32,17 @@
 
 /* Task 1 */
 #define TASK1_PRIO (1)
-#define TASK1_STACK_SIZE    OS_STACK_ALIGN(1024)
+#define TASK1_STACK_SIZE    OS_STACK_ALIGN(256)
 struct os_task task1;
 os_stack_t stack1[TASK1_STACK_SIZE];
 static volatile int g_task1_loops;
 
 /* Task 2 */
 #define TASK2_PRIO (2)
-#define TASK2_STACK_SIZE    OS_STACK_ALIGN(1024)
+#define TASK2_STACK_SIZE    OS_STACK_ALIGN(256)
 struct os_task task2;
 os_stack_t stack2[TASK2_STACK_SIZE];
 
-struct log_handler log_console_handler;
 struct log my_log;
 
 static volatile int g_task2_loops;