Implementation of Embedded OS Lab1 Cortex-M3 Programming.

11
Implementation of Embedded OS Lab1 Cortex-M3 Programming

Transcript of Implementation of Embedded OS Lab1 Cortex-M3 Programming.

Page 1: Implementation of Embedded OS Lab1 Cortex-M3 Programming.

Implementation of Embedded OS

Lab1 Cortex-M3 Programming

Page 2: Implementation of Embedded OS Lab1 Cortex-M3 Programming.

/112 Lab1

Goal Learn how to write programs for the ARM

Cortex-M3 (ARMv7-M) architecture.

2014/3/25

Source: http://www.arm.com/images/Cortex_M3_large.png

Page 3: Implementation of Embedded OS Lab1 Cortex-M3 Programming.

/113 Lab1

Environment Host System

Windows XP Build System

VirtualBox + Ubuntu 8.04 Target System

PTK development board (STM32F207) Software

Documentation & examples PTK_Examples.zip

μC/OS-III source codes KRN-K3XX-000000.zip

IAR Embedded Workbench Installed already

You can download them from RSWiki IEOS Course Software.

2014/3/25

Page 4: Implementation of Embedded OS Lab1 Cortex-M3 Programming.

/114 Lab1

Introduction

2014/3/25

Cortex-M3 processors are a family of 32-bit ARM-based processors for highly deterministic real-time applications. It implements the ARMv7-M architecture.

Nested Vectored Interrupt Controller (NVIC), Memory Protection Unit (MPU), …

It has 3-stage pipeline supporting Thumb/Thumb-2 ISA.

STM32F207 is a SoC consisting of a Cortex-M3 Core, built-in flash storage, and many other peripherals. The core can run up to 120MHz. The on-chip memory includes a flash of 256KB and

a SRAM of 128KB.

Page 5: Implementation of Embedded OS Lab1 Cortex-M3 Programming.

/115 Lab1

Memory Mapping

2014/3/25

The address space of STM32F207 is split into eight 512MB blocks. Block 0 maps the flash memory. Block 1 maps the main memory. Block 2 maps MMIO for

peripherals. Block 3/4 maps external devices

using static memory interface. Block 5 maps control registers of

the flexible static memory controller (FSMC).

Block 7 maps internal registers of the processor core.

Block 0Code

Block 1SRAM

Block 2Peripherals

Block 3FSMC Bank 1/2

Block 4FSMC Bank 3/4

Block 5FSMC

Registers

Block 6Not Used

Block 7Internals

0x0000_0000

0x2000_0000

0x4000_0000

0x6000_0000

0x8000_0000

0xA000_0000

0xC000_0000

0xE000_0000

Page 6: Implementation of Embedded OS Lab1 Cortex-M3 Programming.

/116 Lab1

Connecting PTK Development Board

2014/3/25

JTAG Debugger

RS-232 (COM Port)

Temperature Sensor

Page 7: Implementation of Embedded OS Lab1 Cortex-M3 Programming.

/117 Lab1

IAR Embedded Workbench

2014/3/25

It is a commercial IDE for ARM-based SoCs.

Page 8: Implementation of Embedded OS Lab1 Cortex-M3 Programming.

/118 Lab1

Setting up Examples

2014/3/25

Step 1: decompress the examples PTK_Examples.zip.

Step 2: decompress KRN-K3XX-000000.zip.

Step 3: copy the folder Software in Micrium to PTK_Examples/ePBB/Libraries/OS_uCOS-III/Micrium-V30x. Please do not replace any existing files.

Page 9: Implementation of Embedded OS Lab1 Cortex-M3 Programming.

/119 Lab1

Building and Running the UART Example (1/2)

2014/3/25

Step 1: open the following workspace in IAR Embedded Workbench IDE. PTK_Examples/ePBB/Applications/Projects/PTK-STM32F207/EWARM-V6/OS_uCOS-III/base_uart/demo.eww

Step 2: compile the project by clicking the button “Make”.

Step 3: download the program to the target by clicking the button “Download and Debug”.

Page 10: Implementation of Embedded OS Lab1 Cortex-M3 Programming.

/1110 Lab1

Building and Running the UART Example (2/2)

2014/3/25

Step 4: open the serial console (putty or pietty). Please set baud rate to 115200bps.

Step 5: press the key “F5” to continue the execution.

You will see the message “Hello World!!!” on the console.

Page 11: Implementation of Embedded OS Lab1 Cortex-M3 Programming.

/1111 Lab1

Lab Requirements

2014/3/25

Please create a task in μC/OS-III to read the value of current temperature from the temperature sensor and display it on both the serial console and the LCD screen.

Hints The documentation of these examples can be

found at PTK_Examples/ePBB/Documentations.

You need to initialize the LCD device by invoking “ili9325_gui_config” in the function “platform_board_init_hook”.