Skip to content
This repository was archived by the owner on Dec 6, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions doc/sphinx/source/examples/blinky.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Wiring

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

Building
~~~~~~~~
Preparing
~~~~~~~~~

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

Expand All @@ -40,14 +40,14 @@ Building

cd example_blinky

#. Compile:
Building
~~~~~~~~

* For STM32 Discovery board::
* For STM32 Discovery board::

cd example_blinky
tcore compile --target stm32f4_disc

* For Tiva TM4C LaunchPad::
* For Tiva TM4C LaunchPad::

tcore compile --target tiva_tm4c_launchpad

Expand Down
50 changes: 0 additions & 50 deletions doc/sphinx/source/examples/hello-world-host.rst

This file was deleted.

127 changes: 127 additions & 0 deletions doc/sphinx/source/examples/hello-world.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
.. _theCore_hello_world:

Simple host hello world example
-------------------------------

:Location: https://github.com/theCore-embedded/example_hello_world
:External HW: UART-to-USB converter for STM32F4Discovery board

Supported targets (boards)
~~~~~~~~~~~~~~~~~~~~~~~~~~

+---------------------+--------------------------+-----------------------------------+
| Target name | Configuration file | Description |
+=====================+==========================+===================================+
| host | host.json | Host target build |
+---------------------+--------------------------+-----------------------------------+
| stm32f4_disc | stm32f4_discovery.json | STM32F4 discovery board |
+---------------------+--------------------------+-----------------------------------+
| tiva_tm4c_launchpad | tiva_tm4c_launchpad.json | TM4C123G LaunchPad Evaluation Kit |
+---------------------+--------------------------+-----------------------------------+

Wiring
~~~~~~

* If you have Tiva TM4C Launchpad - simply connect it to the USB.

* If you have STM32F4 Discovery board:

#. Attach any preferable UART-to-USB
converter module (`such as this`_) according to following pinout:

+-------------------+-----------------+
| PD8 (USART3 TX) | module's RX |
+-------------------+-----------------+
| PD9 (USART3 RX) | module's TX |
+-------------------+-----------------+
| GND | module's GND |
+-------------------+-----------------+

#. Connect your STM32 Discovery board to the PC.

Preparing
~~~~~~~~~

#. Install and initialize theCore (if not done previously)::

pip3 install tcore
tcore bootstrap

#. Download the example::

tcore init --remote https://github.com/theCore-embedded/example_hello_world

#. Step into the project directory::

cd example_hello_world

Building
~~~~~~~~

* For STM32 Discovery board::

tcore compile --target stm32f4_disc

* For Tiva TM4C LaunchPad::

tcore compile --target tiva_tm4c_launchpad

* For host::

tcore compile --target host

Running
~~~~~~~

#. If you wish to run the example on the embedded device, launch `minicom`
with device associated with USB <-> UART converter.
(``/dev/ttyUSB0`` here used as an example)::

# From new terminal
tcore runenv "minicom -D /dev/ttyUSB0"

Or the same, but with superuser permissions::

# From new terminal
tcore runenv --sudo "minicom -D /dev/ttyUSB0"

#. Run:

* On TivaC launchpad::

tcore --sudo flash

* For old STM32F407G-DISC boards, with STLINK/V2::

tcore --sudo flash

* For new STM32F407G-DISC1 boards, with STLINK/V2.1::

tcore --sudo flash --debugger-config stlink-v2.1

* For host target, execute::

./build/host/hello_world

Expected output
~~~~~~~~~~~~~~~

Observe console output (either in current shell if running on host, or using
minicom if running on the embedded device)::

Welcome to theCore
the_core v0.3.0.307 9ff344b-dirty
Hello World!

Starting delay demonstration...

[--] Waiting for 2 seconds
[--] Done waiting 2 seconds

[----] Waiting for 4 seconds
[----] Done waiting 4 seconds

[--------] Waiting for 8 seconds
[--------] Done waiting 8 seconds

.. _such as this: http://www.geekfactory.mx/wp-content/uploads/2013/06/converdidor_usb_ttl_rs232_pl_2303hx_01.jpg
2 changes: 1 addition & 1 deletion doc/sphinx/source/examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Examples
:includehidden:

blinky
hello-world-host
hello-world
stm32f4-discovery-htu21d-sensor
stm32f4-discovery-cs43l22
stm32f4-discovery-exti
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinx/source/platform/host.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ For more details on theCore console, check the :ref:`theCore_Console` section.
Related references
~~~~~~~~~~~~~~~~~~

* :ref:`theCore_host_hello`
* :ref:`theCore_hello_world`
1 change: 1 addition & 0 deletions doc/sphinx/source/platform/ti-tivac-tm4c123g.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Available examples

* :ref:`theCore_TM4C_FATFS_SDSPI`
* :ref:`theCore_blinky`
* :ref:`theCore_hello_world`

Periphery overview
~~~~~~~~~~~~~~~~~~
Expand Down
12 changes: 0 additions & 12 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,6 @@ set(THECORE_BUILD_THIRDPARTY_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty_worktre
# Convinient alias
set(ARM_CM4_GNU_TOOLCHAIN ${CMAKE_CURRENT_LIST_DIR}/../toolchains/arm-cm4-gnu.cmake)

################################################################################
# Hello World host example.
################################################################################

ExternalProject_Add(host_hello
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/host_hello
CMAKE_ARGS
-DTHECORE_BUILD_THIRDPARTY_DIR=${THECORE_BUILD_THIRDPARTY_DIR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
BUILD_ALWAYS 1 # Allows to rebuild external project if its files changes
INSTALL_COMMAND echo "Install isn't required, skipping...")

################################################################################
# External interrupt stm32 demo.
################################################################################
Expand Down
31 changes: 0 additions & 31 deletions examples/host_hello/CMakeLists.txt

This file was deleted.

3 changes: 0 additions & 3 deletions examples/host_hello/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions examples/host_hello/host.json

This file was deleted.

13 changes: 0 additions & 13 deletions examples/host_hello/main.cpp

This file was deleted.

7 changes: 7 additions & 0 deletions platform/host/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ configure_file(
${CMAKE_CURRENT_BINARY_DIR}/export/aux/platform_defines.hpp
)

# Platform-generated code

configure_file(
${CMAKE_CURRENT_LIST_DIR}/templates/generated.in.hpp
${CMAKE_CURRENT_BINARY_DIR}/export/aux/generated.hpp
)

target_include_directories(host PUBLIC
export export/platform ${CMAKE_CURRENT_BINARY_DIR}/export/)
target_link_libraries(host PUBLIC types)
Expand Down
14 changes: 14 additions & 0 deletions platform/host/templates/generated.in.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

//! \file
//! \brief Generated definitions template
#ifndef HOST_PLATFORM_GENERATED_
#define HOST_PLATFORM_GENERATED_

// No GPIO on host platform.
extern "C"
inline void gpio_init_generated() { }

#endif // HOST_PLATFORM_GENERATED_