You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ad...@apache.org on 2017/04/19 18:18:06 UTC

[10/30] incubator-mynewt-core git commit: olimex_stm32-e407; add syscfg option to enable ethernet.

olimex_stm32-e407; add syscfg option to enable ethernet.


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

Branch: refs/heads/master
Commit: c9afda6eacafbe2ff004e93d72bdb5e9a2664755
Parents: c5f8cf6
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Fri Apr 14 10:43:49 2017 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Apr 14 13:21:30 2017 -0700

----------------------------------------------------------------------
 .../include/bsp/stm32f4xx_hal_conf.h            |  1 +
 hw/bsp/olimex_stm32-e407_devboard/pkg.yml       |  4 +-
 hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c | 41 +++++++++++++++++++-
 hw/bsp/olimex_stm32-e407_devboard/syscfg.yml    |  4 ++
 4 files changed, 46 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c9afda6e/hw/bsp/olimex_stm32-e407_devboard/include/bsp/stm32f4xx_hal_conf.h
----------------------------------------------------------------------
diff --git a/hw/bsp/olimex_stm32-e407_devboard/include/bsp/stm32f4xx_hal_conf.h b/hw/bsp/olimex_stm32-e407_devboard/include/bsp/stm32f4xx_hal_conf.h
index fb65323..b2b7717 100644
--- a/hw/bsp/olimex_stm32-e407_devboard/include/bsp/stm32f4xx_hal_conf.h
+++ b/hw/bsp/olimex_stm32-e407_devboard/include/bsp/stm32f4xx_hal_conf.h
@@ -95,6 +95,7 @@
 #define HAL_FLASH_MODULE_ENABLED
 #define HAL_GPIO_MODULE_ENABLED
 #define HAL_I2C_MODULE_ENABLED
+#define HAL_ETH_MODULE_ENABLED
 #define HAL_IWDG_MODULE_ENABLED
 #define HAL_PWR_MODULE_ENABLED
 #define HAL_RCC_MODULE_ENABLED

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c9afda6e/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 7aefaab..f4e6020 100644
--- a/hw/bsp/olimex_stm32-e407_devboard/pkg.yml
+++ b/hw/bsp/olimex_stm32-e407_devboard/pkg.yml
@@ -48,5 +48,5 @@ pkg.deps.ADC_3:
 pkg.deps.UART_0:
     - hw/drivers/uart/uart_hal
 
-pkg.deps.UART_1:
-    - hw/drivers/uart/uart_bitbang
+pkg.deps.ETH_0:
+    - hw/drivers/lwip/stm32_eth

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c9afda6e/hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c b/hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c
index d0bcc39..8d9daf7 100644
--- a/hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c
+++ b/hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c
@@ -41,6 +41,10 @@
 #if MYNEWT_VAL(SPI_0_MASTER) || MYNEWT_VAL(SPI_0_SLAVE)
 #include "hal/hal_spi.h"
 #endif
+#if MYNEWT_VAL(ETH_0)
+#include "stm32_eth/stm32_eth.h"
+#include "stm32_eth/stm32_eth_cfg.h"
+#endif
 #include "mcu/stm32f4_bsp.h"
 #include "mcu/stm32f4xx_mynewt_hal.h"
 
@@ -48,8 +52,6 @@
 struct uart_dev hal_uart0;
 #endif
 
-/* XXX should not be here */
-
 #if MYNEWT_VAL(ADC_1)
 struct adc_dev my_dev_adc1;
 #endif
@@ -286,6 +288,36 @@ static const struct stm32f4_uart_cfg uart_cfg0 = {
     .suc_irqn = USART6_IRQn
 };
 #endif
+#if MYNEWT_VAL(ETH_0)
+static const struct stm32_eth_cfg eth_cfg = {
+    /*
+     * PORTA
+     *   PA1 - ETH_RMII_REF_CLK
+     *   PA2 - ETH_RMII_MDIO
+     *   PA3 - ETH_RMII_MDINT  (GPIO irq?)
+     *   PA7 - ETH_RMII_CRS_DV
+     */
+    .sec_port_mask[0] = (1 << 1) | (1 << 2) | (1 << 7),
+
+    /*
+     * PORTC
+     *   PC1 - ETH_RMII_MDC
+     *   PC4 - ETH_RMII_RXD0
+     *   PC5 - ETH_RMII_RXD1
+     */
+    .sec_port_mask[2] = (1 << 1) | (1 << 4) | (1 << 5),
+
+    /*
+     * PORTG
+     *   PG11 - ETH_RMII_TXEN
+     *   PG13 - ETH_RMII_TXD0
+     *   PG14 - ETH_RMII_TXD1
+     */
+    .sec_port_mask[6] = (1 << 11) | (1 << 13) | (1 << 14),
+    .sec_phy_type = SMSC_8710_RMII,
+    .sec_phy_irq = MCU_GPIO_PORTA(3)
+};
+#endif
 static const struct hal_bsp_mem_dump dump_cfg[] = {
     [0] = {
         .hbmd_start = &_ram_start,
@@ -387,4 +419,9 @@ hal_bsp_init(void)
 #if MYNEWT_VAL(TIMER_0)
     hal_timer_init(0, TIM9);
 #endif
+
+#if MYNEWT_VAL(ETH_0)
+    rc = stm32_eth_init(&eth_cfg);
+    assert(rc == 0);
+#endif
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c9afda6e/hw/bsp/olimex_stm32-e407_devboard/syscfg.yml
----------------------------------------------------------------------
diff --git a/hw/bsp/olimex_stm32-e407_devboard/syscfg.yml b/hw/bsp/olimex_stm32-e407_devboard/syscfg.yml
index 7b2fe59..4e49b0c 100644
--- a/hw/bsp/olimex_stm32-e407_devboard/syscfg.yml
+++ b/hw/bsp/olimex_stm32-e407_devboard/syscfg.yml
@@ -52,6 +52,10 @@ syscfg.defs:
         description: 'TIMER_0'
         value: 0
 
+    ETH_0:
+        description: 'Ethernet driver for LwIP'
+        value: 0
+
 syscfg.vals:
     REBOOT_LOG_FLASH_AREA: FLASH_AREA_REBOOT_LOG
     CONFIG_FCB_FLASH_AREA: FLASH_AREA_NFFS