Skip to content

Commit 32e6dcf

Browse files
committed
Add: w5500 driver
1 parent 63392f2 commit 32e6dcf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1849
-86
lines changed

bsp/ejs/stm32/bearpi_stm32l431/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
cmake_minimum_required(VERSION 3.13.1)
44

55
set(BOARD_ROOT ${CMAKE_CURRENT_LIST_DIR})
6-
76
set(SOC_ROOT ${CMAKE_CURRENT_LIST_DIR})
8-
9-
107
set(DTS_ROOT ${CMAKE_CURRENT_LIST_DIR}/dts)
118

129
set(BOARD bearpi_stm32l431)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
cmake_minimum_required(VERSION 3.13.1)
4+
5+
set(BOARD_ROOT ${CMAKE_CURRENT_LIST_DIR})
6+
set(DTS_ROOT ${CMAKE_CURRENT_LIST_DIR}/dts)
7+
8+
set(BOARD stm32f103_fire_arbitrary)
9+
10+
set(EVM_BASE ${ZEPHYR_BASE}/../../../)
11+
12+
list(APPEND ZEPHYR_EXTRA_MODULES
13+
${EVM_BASE}/modules/heatshrink
14+
)
15+
16+
find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})
17+
project(ejs)
18+
19+
set(LIBEJS ${EVM_BASE}/lib/arm-none-eabi-gcc/cortex-m3/libejs.a)
20+
message(${LIBEJS})
21+
target_link_libraries(app PRIVATE ${LIBEJS})
22+
23+
set(evm_ecma_sources
24+
${EVM_BASE}/modules/ecma/ecma.c
25+
${EVM_BASE}/modules/ecma/ecma_object.c
26+
${EVM_BASE}/modules/ecma/ecma_array.c
27+
${EVM_BASE}/modules/ecma/ecma_math.c
28+
${EVM_BASE}/modules/ecma/ecma_regexp.c
29+
${EVM_BASE}/modules/ecma/ecma_number.c
30+
${EVM_BASE}/modules/ecma/ecma_string.c
31+
${EVM_BASE}/modules/ecma/re.c
32+
)
33+
set(evm_driver_sources
34+
${EVM_BASE}/drivers/zephyr/uol/adc_driver.c
35+
${EVM_BASE}/drivers/zephyr/uol/can_driver.c
36+
${EVM_BASE}/drivers/zephyr/uol/dac_driver.c
37+
${EVM_BASE}/drivers/zephyr/uol/flash_driver.c
38+
${EVM_BASE}/drivers/zephyr/uol/gpio_driver.c
39+
${EVM_BASE}/drivers/zephyr/uol/i2c_driver.c
40+
${EVM_BASE}/drivers/zephyr/uol/rtc_driver.c
41+
${EVM_BASE}/drivers/zephyr/uol/spi_driver.c
42+
${EVM_BASE}/drivers/zephyr/uol/timer_driver.c
43+
${EVM_BASE}/drivers/zephyr/uol/uart_driver.c
44+
${EVM_BASE}/drivers/zephyr/uol/watchdog_driver.c
45+
${EVM_BASE}/drivers/zephyr/uol/pwm_driver.c
46+
${EVM_BASE}/drivers/zephyr/uol/sys_driver.c
47+
)
48+
49+
set(evm_modules_sources
50+
${EVM_BASE}/modules/evm/evm_module.c
51+
${EVM_BASE}/modules/evm/evm_module_adc.c
52+
${EVM_BASE}/modules/evm/evm_module_can.c
53+
${EVM_BASE}/modules/evm/evm_module_dac.c
54+
${EVM_BASE}/modules/evm/evm_module_flash.c
55+
${EVM_BASE}/modules/evm/evm_module_i2c.c
56+
${EVM_BASE}/modules/evm/evm_module_lcd.c
57+
${EVM_BASE}/modules/evm/evm_module_led.c
58+
${EVM_BASE}/modules/evm/evm_module_pin.c
59+
${EVM_BASE}/modules/evm/evm_module_rtc.c
60+
${EVM_BASE}/modules/evm/evm_module_spi.c
61+
${EVM_BASE}/modules/evm/evm_module_switch.c
62+
${EVM_BASE}/modules/evm/evm_module_timer.c
63+
${EVM_BASE}/modules/evm/evm_module_uart.c
64+
${EVM_BASE}/modules/evm/evm_module_watchdog.c
65+
${EVM_BASE}/modules/evm/evm_module_led.c
66+
${EVM_BASE}/modules/evm/evm_module_wifi.c
67+
)
68+
69+
if(CONFIG_EVM_W5500)
70+
include_directories(app PRIVATE ${EVM_BASE}/drivers/zephyr/ethernet)
71+
include_directories(app PRIVATE ${EVM_BASE}/drivers/zephyr/ethernet/w5500/ioLibrary/Ethernet)
72+
set(evm_driver_w5500_src
73+
${EVM_BASE}/drivers/zephyr/ethernet/w5500/ioLibrary/Ethernet/wizchip_conf.c
74+
${EVM_BASE}/drivers/zephyr/ethernet/w5500/ioLibrary/Ethernet/W5500/w5500.c
75+
${EVM_BASE}/drivers/zephyr/ethernet/w5500/driver_w5500.c
76+
)
77+
endif()
78+
79+
set(libevm_module_sources
80+
${evm_driver_sources}
81+
${evm_modules_sources}
82+
${evm_ecma_sources}
83+
${evm_driver_w5500_src}
84+
)
85+
86+
include_directories(app PRIVATE ${EVM_BASE}/include)
87+
include_directories(app PRIVATE ${EVM_BASE}/bsp/common)
88+
include_directories(app PRIVATE ${EVM_BASE}/modules/ecma)
89+
include_directories(app PRIVATE ${EVM_BASE}/modules/evm)
90+
91+
92+
include_directories(app PRIVATE src)
93+
94+
target_sources(app PRIVATE ${libevm_module_sources})
95+
target_sources(app PRIVATE src/main.c)
96+
target_sources(app PRIVATE ${EVM_BASE}/bsp/common/evm_main.c)
97+
target_sources(app PRIVATE src/evm_board.c)
98+
target_sources(app PRIVATE ${EVM_BASE}/bsp/common/uol_output.c)
99+
100+
# evm module config
101+
add_definitions("-DCONFIG_EVM_TIMER")
102+
103+
# ecma module config
104+
add_definitions("-DCONFIG_EVM_ECMA_OBJECT")
105+
add_definitions("-DCONFIG_EVM_ECMA_ARRAY")
106+
107+
# language config
108+
add_definitions("-DCONFIG_EVM_LANG_JS")
109+
110+
111+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
if(CONFIG_PINMUX)
4+
zephyr_library()
5+
zephyr_library_sources(pinmux.c)
6+
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
7+
endif()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
config ETH_W5500
2+
bool "Enable wiznet w5500 ethernet controller"
3+
default n
4+
5+
config ETH_W5500_RX_THREAD_STACK_SIZE
6+
int
7+
default 800
8+
9+
config ETH_W5500_RX_THREAD_PRIO
10+
int
11+
default 2
12+
13+
config ETH_W5500_TIMEOUT
14+
int
15+
default 100
16+
17+
config ETH_W5500_TX_BUF_SIZE
18+
int
19+
default 2
20+
21+
config ETH_W5500_RX_BUF_SIZE
22+
int
23+
default 2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# NUCLEO-64 F103RB board configuration
2+
3+
# Copyright (c) 2016 Open-RnD Sp. z o.o.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config STM32F103_FIRE_ARBITRARY
7+
bool "stm32f103 fire arbitrary Development Board"
8+
depends on SOC_STM32F103XE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# NUCLEO-64 F103RB board configuration
2+
3+
# Copyright (c) 2016 Open-RnD Sp. z o.o.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
if STM32F103_FIRE_ARBITRARY
7+
8+
config BOARD
9+
default "stm32f103_fire_arbitrary"
10+
11+
endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
board_runner_args(jlink "--device=STM32F103ZE" "--speed=4000")
4+
5+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
6+
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
.. _nucleo_f103rb_board:
2+
3+
ST Nucleo F103RB
4+
################
5+
6+
Overview
7+
********
8+
The STM32 Nucleo-64 development board with STM32F103RB MCU, supports Arduino and ST morpho connectivity.
9+
10+
The STM32 Nucleo board provides an affordable, and flexible way for users to try out new concepts,
11+
and build prototypes with the STM32 microcontroller, choosing from the various
12+
combinations of performance, power consumption, and features.
13+
14+
The Arduino* Uno V3 connectivity support and the ST morpho headers allow easy functionality
15+
expansion of the STM32 Nucleo open development platform with a wide choice of
16+
specialized shields.
17+
18+
The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer.
19+
20+
The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together
21+
with various packaged software examples.
22+
23+
.. image:: img/nucleo_f103rb.jpg
24+
:width: 500px
25+
:height: 367px
26+
:align: center
27+
:alt: Nucleo F103RB
28+
29+
More information about the board can be found at the `Nucleo F103RB website`_.
30+
31+
Hardware
32+
********
33+
Nucleo F103RB provides the following hardware components:
34+
35+
- STM32 microcontroller in QFP64 package
36+
- Two types of extension resources:
37+
38+
- Arduino* Uno V3 connectivity
39+
- ST morpho extension pin headers for full access to all STM32 I/Os
40+
41+
- ARM* mbed*
42+
- On-board ST-LINK/V2-1 debugger/programmer with SWD connector:
43+
44+
- Selection-mode switch to use the kit as a standalone ST-LINK/V2-1
45+
46+
- Flexible board power supply:
47+
48+
- USB VBUS or external source (3.3V, 5V, 7 - 12V)
49+
- Power management access point
50+
51+
- Three LEDs:
52+
53+
- USB communication (LD1), user LED (LD2), power LED (LD3)
54+
55+
- Two push-buttons: USER and RESET
56+
- USB re-enumeration capability. Three different interfaces supported on USB:
57+
58+
- Virtual COM port
59+
- Mass storage
60+
- Debug port
61+
62+
- Support of wide choice of Integrated Development Environments (IDEs) including:
63+
64+
- IAR
65+
- ARM Keil
66+
- GCC-based IDEs
67+
68+
More information about STM32F103RB can be found here:
69+
70+
- `STM32F103 reference manual`_
71+
- `STM32F103 data sheet`_
72+
73+
Supported Features
74+
==================
75+
76+
The Zephyr nucleo_f103rb board configuration supports the following hardware features:
77+
78+
+-----------+------------+-------------------------------------+
79+
| Interface | Controller | Driver/Component |
80+
+===========+============+=====================================+
81+
| NVIC | on-chip | nested vector interrupt controller |
82+
+-----------+------------+-------------------------------------+
83+
| UART | on-chip | serial port-polling; |
84+
| | | serial port-interrupt |
85+
+-----------+------------+-------------------------------------+
86+
| PINMUX | on-chip | pinmux |
87+
+-----------+------------+-------------------------------------+
88+
| GPIO | on-chip | gpio |
89+
+-----------+------------+-------------------------------------+
90+
| CLOCK | on-chip | reset and clock control |
91+
+-----------+------------+-------------------------------------+
92+
| FLASH | on-chip | flash memory |
93+
+-----------+------------+-------------------------------------+
94+
| WATCHDOG | on-chip | independent watchdog |
95+
+-----------+------------+-------------------------------------+
96+
| ADC | on-chip | ADC Controller |
97+
+-----------+------------+-------------------------------------+
98+
99+
Other hardware features are not yet supported in this Zephyr port.
100+
101+
The default configuration can be found in the defconfig file:
102+
``boards/arm/nucleo_f103rb/nucleo_f103rb_defconfig``
103+
104+
Connections and IOs
105+
===================
106+
107+
Each of the GPIO pins can be configured by software as output (push-pull or open-drain), as
108+
input (with or without pull-up or pull-down), or as peripheral alternate function. Most of the
109+
GPIO pins are shared with digital or analog alternate functions. All GPIOs are high current
110+
capable except for analog inputs.
111+
112+
Board connectors:
113+
-----------------
114+
.. image:: img/nucleo_f103rb_connectors.png
115+
:width: 800px
116+
:align: center
117+
:height: 619px
118+
:alt: Nucleo F103RB connectors
119+
120+
Default Zephyr Peripheral Mapping:
121+
----------------------------------
122+
123+
- UART_1 TX/RX : PA9/PA10
124+
- UART_2 TX/RX : PA2/PA3 (ST-Link Virtual COM Port)
125+
- SPI1 NSS/SCK/MISO/MOSI : PA4/PA5/PA6/PA7 (Arduino SPI)
126+
- SPI2 SCK/MISO/MOSI : PB12/PB13/PB14/PB15
127+
- PWM1_CH1: PA8
128+
- USER_PB : PC13
129+
- LD1 : PA5
130+
131+
For mode details please refer to `STM32 Nucleo-64 board User Manual`_.
132+
133+
Programming and Debugging
134+
*************************
135+
136+
Applications for the ``nucleo_f103rb`` board configuration can be built and
137+
flashed in the usual way (see :ref:`build_an_application` and
138+
:ref:`application_run` for more details).
139+
140+
Flashing
141+
========
142+
143+
Nucleo F103RB board includes an ST-LINK/V2-1 embedded debug tool interface.
144+
This interface is supported by the openocd version included in the Zephyr SDK.
145+
146+
Flashing an application to Nucleo F103RB
147+
----------------------------------------
148+
149+
Here is an example for the :ref:`blinky-sample` application.
150+
151+
.. zephyr-app-commands::
152+
:zephyr-app: samples/basic/blinky
153+
:board: nucleo_f103rb
154+
:goals: build flash
155+
156+
You will see the LED blinking every second.
157+
158+
Debugging
159+
=========
160+
161+
You can debug an application in the usual way. Here is an example for the
162+
:ref:`blinky-sample` application.
163+
164+
.. zephyr-app-commands::
165+
:zephyr-app: samples/basic/blinky
166+
:board: nucleo_f103rb
167+
:maybe-skip-config:
168+
:goals: debug
169+
170+
References
171+
**********
172+
173+
.. target-notes::
174+
175+
.. _Nucleo F103RB website:
176+
http://www.st.com/en/evaluation-tools/nucleo-f103rb.html
177+
178+
.. _STM32F103 reference manual:
179+
http://www.st.com/resource/en/reference_manual/cd00171190.pdf
180+
181+
.. _STM32F103 data sheet:
182+
http://www.st.com/resource/en/datasheet/stm32f103rb.pdf
183+
184+
.. _STM32 Nucleo-64 board User Manual:
185+
http://www.st.com/resource/en/user_manual/dm00105823.pdf

0 commit comments

Comments
 (0)