stm32f767-nucleo; 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/383906f4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/383906f4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/383906f4 Branch: refs/heads/master Commit: 383906f4318f518add476699c04cf7a7d961d0d0 Parents: c9afda6 Author: Marko Kiiskila <ma...@runtime.io> Authored: Fri Apr 14 10:44:47 2017 -0700 Committer: Marko Kiiskila <ma...@runtime.io> Committed: Fri Apr 14 13:21:30 2017 -0700 ---------------------------------------------------------------------- hw/bsp/stm32f767-nucleo/pkg.yml | 3 ++ hw/bsp/stm32f767-nucleo/src/hal_bsp.c | 50 ++++++++++++++++++++++++++++++ hw/bsp/stm32f767-nucleo/syscfg.yml | 4 +++ 3 files changed, 57 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/383906f4/hw/bsp/stm32f767-nucleo/pkg.yml ---------------------------------------------------------------------- diff --git a/hw/bsp/stm32f767-nucleo/pkg.yml b/hw/bsp/stm32f767-nucleo/pkg.yml index 5b3e684..da9cfb2 100644 --- a/hw/bsp/stm32f767-nucleo/pkg.yml +++ b/hw/bsp/stm32f767-nucleo/pkg.yml @@ -38,3 +38,6 @@ pkg.deps: pkg.deps.UART_0: - hw/drivers/uart/uart_hal + +pkg.deps.ETH_0: + - hw/drivers/lwip/stm32_eth http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/383906f4/hw/bsp/stm32f767-nucleo/src/hal_bsp.c ---------------------------------------------------------------------- diff --git a/hw/bsp/stm32f767-nucleo/src/hal_bsp.c b/hw/bsp/stm32f767-nucleo/src/hal_bsp.c index 34fd01c..6a7b8e0 100644 --- a/hw/bsp/stm32f767-nucleo/src/hal_bsp.c +++ b/hw/bsp/stm32f767-nucleo/src/hal_bsp.c @@ -21,6 +21,7 @@ #include <syscfg/syscfg.h> #include <os/os_dev.h> +#include <os/os_cputime.h> #if MYNEWT_VAL(UART_0) #include <uart/uart.h> #include <uart_hal/uart_hal.h> @@ -35,6 +36,11 @@ #include <stm32f7xx_hal_gpio_ex.h> #include <mcu/stm32f7_bsp.h> +#if MYNEWT_VAL(ETH_0) +#include <stm32_eth/stm32_eth.h> +#include <stm32_eth/stm32_eth_cfg.h> +#endif + #include "bsp/bsp.h" #if MYNEWT_VAL(UART_0) @@ -55,6 +61,41 @@ static const struct stm32f7_uart_cfg uart_cfg[UART_CNT] = { }; #endif +#if MYNEWT_VAL(ETH_0) +static const struct stm32_eth_cfg eth_cfg = { + /* + * PORTA + * PA1 - ETH_RMII_REF_CLK + * PA2 - ETH_RMII_MDIO + * PA7 - ETH_RMII_CRS_DV + */ + .sec_port_mask[0] = (1 << 1) | (1 << 2) | (1 << 7), + + /* + * PORTB + * PB13 - ETH_RMII_TXD1 + */ + .sec_port_mask[1] = (1 << 13), + + /* + * 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 + */ + .sec_port_mask[6] = (1 << 11) | (1 << 13), + .sec_phy_type = LAN_8742_RMII, + .sec_phy_irq = -1 +}; +#endif + /* FIXME */ static const struct hal_bsp_mem_dump dump_cfg[] = { [0] = { @@ -114,6 +155,15 @@ hal_bsp_init(void) #if MYNEWT_VAL(TIMER_2) hal_timer_init(2, TIM9); #endif + +#if (MYNEWT_VAL(OS_CPUTIME_TIMER_NUM) >= 0) + rc = os_cputime_init(MYNEWT_VAL(OS_CPUTIME_FREQ)); + assert(rc == 0); +#endif + +#if MYNEWT_VAL(ETH_0) + stm32_eth_init(ð_cfg); +#endif } /** http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/383906f4/hw/bsp/stm32f767-nucleo/syscfg.yml ---------------------------------------------------------------------- diff --git a/hw/bsp/stm32f767-nucleo/syscfg.yml b/hw/bsp/stm32f767-nucleo/syscfg.yml index a4d2a73..fb083ed 100644 --- a/hw/bsp/stm32f767-nucleo/syscfg.yml +++ b/hw/bsp/stm32f767-nucleo/syscfg.yml @@ -31,6 +31,10 @@ syscfg.defs: description: 'Timer 2' value: 1 + 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