Skip to content
This repository was archived by the owner on Dec 6, 2018. It is now read-only.

Commit 5f9eb56

Browse files
committed
Merge pull request #388 from forGGe/g378_migrate_hello_world
Migrate hello-world example
2 parents 9ff344b + 22b97b2 commit 5f9eb56

File tree

13 files changed

+157
-120
lines changed

13 files changed

+157
-120
lines changed

doc/sphinx/source/examples/blinky.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ Wiring
2424

2525
No special wiring is required. Just connect the board to the powered USB port.
2626

27-
Building
28-
~~~~~~~~
27+
Preparing
28+
~~~~~~~~~
2929

3030
#. Install theCore (this may take a while)::
3131

@@ -40,14 +40,14 @@ Building
4040

4141
cd example_blinky
4242

43-
#. Compile:
43+
Building
44+
~~~~~~~~
4445

45-
* For STM32 Discovery board::
46+
* For STM32 Discovery board::
4647

47-
cd example_blinky
4848
tcore compile --target stm32f4_disc
4949

50-
* For Tiva TM4C LaunchPad::
50+
* For Tiva TM4C LaunchPad::
5151

5252
tcore compile --target tiva_tm4c_launchpad
5353

doc/sphinx/source/examples/hello-world-host.rst

Lines changed: 0 additions & 50 deletions
This file was deleted.
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
.. _theCore_hello_world:
2+
3+
Simple host hello world example
4+
-------------------------------
5+
6+
:Location: https://github.com/theCore-embedded/example_hello_world
7+
:External HW: UART-to-USB converter for STM32F4Discovery board
8+
9+
Supported targets (boards)
10+
~~~~~~~~~~~~~~~~~~~~~~~~~~
11+
12+
+---------------------+--------------------------+-----------------------------------+
13+
| Target name | Configuration file | Description |
14+
+=====================+==========================+===================================+
15+
| host | host.json | Host target build |
16+
+---------------------+--------------------------+-----------------------------------+
17+
| stm32f4_disc | stm32f4_discovery.json | STM32F4 discovery board |
18+
+---------------------+--------------------------+-----------------------------------+
19+
| tiva_tm4c_launchpad | tiva_tm4c_launchpad.json | TM4C123G LaunchPad Evaluation Kit |
20+
+---------------------+--------------------------+-----------------------------------+
21+
22+
Wiring
23+
~~~~~~
24+
25+
* If you have Tiva TM4C Launchpad - simply connect it to the USB.
26+
27+
* If you have STM32F4 Discovery board:
28+
29+
#. Attach any preferable UART-to-USB
30+
converter module (`such as this`_) according to following pinout:
31+
32+
+-------------------+-----------------+
33+
| PD8 (USART3 TX) | module's RX |
34+
+-------------------+-----------------+
35+
| PD9 (USART3 RX) | module's TX |
36+
+-------------------+-----------------+
37+
| GND | module's GND |
38+
+-------------------+-----------------+
39+
40+
#. Connect your STM32 Discovery board to the PC.
41+
42+
Preparing
43+
~~~~~~~~~
44+
45+
#. Install and initialize theCore (if not done previously)::
46+
47+
pip3 install tcore
48+
tcore bootstrap
49+
50+
#. Download the example::
51+
52+
tcore init --remote https://github.com/theCore-embedded/example_hello_world
53+
54+
#. Step into the project directory::
55+
56+
cd example_hello_world
57+
58+
Building
59+
~~~~~~~~
60+
61+
* For STM32 Discovery board::
62+
63+
tcore compile --target stm32f4_disc
64+
65+
* For Tiva TM4C LaunchPad::
66+
67+
tcore compile --target tiva_tm4c_launchpad
68+
69+
* For host::
70+
71+
tcore compile --target host
72+
73+
Running
74+
~~~~~~~
75+
76+
#. If you wish to run the example on the embedded device, launch `minicom`
77+
with device associated with USB <-> UART converter.
78+
(``/dev/ttyUSB0`` here used as an example)::
79+
80+
# From new terminal
81+
tcore runenv "minicom -D /dev/ttyUSB0"
82+
83+
Or the same, but with superuser permissions::
84+
85+
# From new terminal
86+
tcore runenv --sudo "minicom -D /dev/ttyUSB0"
87+
88+
#. Run:
89+
90+
* On TivaC launchpad::
91+
92+
tcore --sudo flash
93+
94+
* For old STM32F407G-DISC boards, with STLINK/V2::
95+
96+
tcore --sudo flash
97+
98+
* For new STM32F407G-DISC1 boards, with STLINK/V2.1::
99+
100+
tcore --sudo flash --debugger-config stlink-v2.1
101+
102+
* For host target, execute::
103+
104+
./build/host/hello_world
105+
106+
Expected output
107+
~~~~~~~~~~~~~~~
108+
109+
Observe console output (either in current shell if running on host, or using
110+
minicom if running on the embedded device)::
111+
112+
Welcome to theCore
113+
the_core v0.3.0.307 9ff344b-dirty
114+
Hello World!
115+
116+
Starting delay demonstration...
117+
118+
[--] Waiting for 2 seconds
119+
[--] Done waiting 2 seconds
120+
121+
[----] Waiting for 4 seconds
122+
[----] Done waiting 4 seconds
123+
124+
[--------] Waiting for 8 seconds
125+
[--------] Done waiting 8 seconds
126+
127+
.. _such as this: http://www.geekfactory.mx/wp-content/uploads/2013/06/converdidor_usb_ttl_rs232_pl_2303hx_01.jpg

doc/sphinx/source/examples/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Examples
88
:includehidden:
99

1010
blinky
11-
hello-world-host
11+
hello-world
1212
stm32f4-discovery-htu21d-sensor
1313
stm32f4-discovery-cs43l22
1414
stm32f4-discovery-exti

doc/sphinx/source/platform/host.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ For more details on theCore console, check the :ref:`theCore_Console` section.
2222
Related references
2323
~~~~~~~~~~~~~~~~~~
2424

25-
* :ref:`theCore_host_hello`
25+
* :ref:`theCore_hello_world`

doc/sphinx/source/platform/ti-tivac-tm4c123g.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Available examples
5151

5252
* :ref:`theCore_TM4C_FATFS_SDSPI`
5353
* :ref:`theCore_blinky`
54+
* :ref:`theCore_hello_world`
5455

5556
Periphery overview
5657
~~~~~~~~~~~~~~~~~~

examples/CMakeLists.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,6 @@ set(THECORE_BUILD_THIRDPARTY_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty_worktre
1818
# Convinient alias
1919
set(ARM_CM4_GNU_TOOLCHAIN ${CMAKE_CURRENT_LIST_DIR}/../toolchains/arm-cm4-gnu.cmake)
2020

21-
################################################################################
22-
# Hello World host example.
23-
################################################################################
24-
25-
ExternalProject_Add(host_hello
26-
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/host_hello
27-
CMAKE_ARGS
28-
-DTHECORE_BUILD_THIRDPARTY_DIR=${THECORE_BUILD_THIRDPARTY_DIR}
29-
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
30-
BUILD_ALWAYS 1 # Allows to rebuild external project if its files changes
31-
INSTALL_COMMAND echo "Install isn't required, skipping...")
32-
3321
################################################################################
3422
# External interrupt stm32 demo.
3523
################################################################################

examples/host_hello/CMakeLists.txt

Lines changed: 0 additions & 31 deletions
This file was deleted.

examples/host_hello/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/host_hello/host.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)