The Cortex-M3 and Cortex-M4 processors have:
- Three-stage pipeline design
- Harvard bus architecture with unified memory space: instructions and data use the same address space.
- 32-bit addressing, supporting 4GB of memory space
- On-chip bus interfaces based on ARM AMBA. (Advanced Microcontroller Bus Architecture)Technology,which allowpipelined bus operations for higher throughput
- An interrupt controller called NVIC (Nested Vectored Interrupt Controller) supporting up to 240 interrupt requests and from 8 to 256 interrupt priority levels (dependent on the actual device implementation)
- Support for various features for OS (Operating System) implementation such as a system tick timer, shadowed stack pointer
- Sleep mode support and various low power features
- Support for an optional MPU (Memory Protection Unit) to provide memory protection features like programmable memory, or access permission control
- Support for bit-data accesses in two specific memory regions using a feature called Bit Band
- The option of being used in single processor or multi-processor designs
- General data processing, including hardware divide instructions
- Memory access instructions supporting 8-bit, 16-bit, 32-bit, and 64-bit data, as well as instructions for transferring multiple 32-bit data
- Instructions for bit field processing
- Multiply Accumulate (MAC) and saturate instructions
- Instructions for branches, conditional branches and function calls
- Instructions for system control, OS support, etc.
- Both the Cortex-M3 and Cortex-M4 processors are widely used in modern microcontroller products, as well as other specialized silicon designs such as System on Chips (SoC) and Application Specific Standard Products (ASSP).
There are a lot of similarities between the Cortex-M3 and Cortex-M4 processors. Most of the instructions are available on both processors, and the processors have the same programmer’s model for NVIC, MPU, etc. However, there are some differences in their internal designs, which allow the Cortex-M4 processor to deliver higher performance in DSP applications, and to support floating point operations. As a result, some of the instructions available on both processors can be executed in fewer clock cycles on the Cortex-M4.
Without wasting much time in learning theory, lets start with practical, in this set of tutorials we are going to use LPC1343 micro-controller from NXP family, which comes under the category of Cortex-M3.
BlueBoard LPC1343 |
The current available choices included various products from the following vendors:
CoIDE can be downloaded from http://www.coocox.org/software.html
For CoLinkEx, have a look at this link ttp://www.coocox.org/hardware/colinkex.php
The following video shows how to create a project in CooCox CoIDE and a technique known as "Semi-hosting", which is very useful for debugging and printing messages without requiring any other interface, just the CoLink-Ex debugger will do the work.
Schematic Diagram for Blink LED's
The LPC1343 development board which we are using in this tutorial has two Led's, one green and another is Blue, the following program will toggle the Led's after 1 second.
There are two important functions in this file:
Led's status when this program runs in development board can be seen below:
- Keil. Microcontroller Development Kit (MDK-ARM)
- ARM. DS-5. (Development Studio 5)
- IAR Systems (Embedded Workbench for ARM Cortex-M)
- Red Suite from Code Red Technologies (acquired by NXP in 2013)
- Mentor Graphics Sourcery CodeBench (formerly CodeSourcery Sourcery)
- mbed.org
- Altium Tasking VX-toolset for ARM Cortex-M
- Rowley Associates (CrossWorks)
- Coocox
- Texas Instruments Code Composer Studio (CCS)
- Raisonance RIDE
- Atollic TrueStudio
- GNU Compiler Collection (GCC)
- ImageCraft ICCV8
- Cosmic Software C Cross Compiler for Cortex-M
- mikroElektronika mikroC
- Arduino
CoIDE can be downloaded from http://www.coocox.org/software.html
For CoLinkEx, have a look at this link ttp://www.coocox.org/hardware/colinkex.php
The following video shows how to create a project in CooCox CoIDE and a technique known as "Semi-hosting", which is very useful for debugging and printing messages without requiring any other interface, just the CoLink-Ex debugger will do the work.
Schematic Diagram |
#include "config.h"
#include "lpc13xx_gpio.h"
int main(void)
{
u32_t count = 0, time = 0;
boolean led_state = TRUE;
InitializeSystem(); // Initialize System Clock and SysTick Interrupt
// Power On the GPIO Clock
SYSCON_AHBPeriphClockCmd(SYSCON_AHBPeriph_GPIO, ENABLE);
// Set Direction as Output
GPIO_SetDir(PORT1, GreenLED, 1);
GPIO_SetDir(PORT1, BlueLED, 1);
time = millis();
while(1)
{
if(millis() - time > 1000)
{
time = millis();
if(led_state == TRUE)
{
led_state = FALSE;
// Set GPIO pins State High
GPIO_SetBits(PORT1, GreenLED);
GPIO_SetBits(PORT1, BlueLED);
}
else
{
led_state = TRUE;
// Set GPIO pins State Low
GPIO_ResetBits(PORT1, GreenLED);
GPIO_ResetBits(PORT1, BlueLED);
}
}
#ifdef SEMIHOSTING
printf("Count Value is %d\n", count);
#endif
count++;
}
}
There is a file included as #include "config.h", this file is not a part of CooCox community, and is written for the LPC1343 Development Board, the content of this file is shown below.
#ifndef CONFIG_H_
#define CONFIG_H_
// Un-Comment this to view debug data on SemiHosting window
// But this will hamper program speed.
// To run in run time Un-Comment this MACRO
#define SEMIHOSTING
#include <stdio.h>
#include "lpc13xx_syscon.h"
#include "micro.h"
#ifdef SEMIHOSTING
#include "semihosting.h"
#endif
#define GreenLED GPIO_Pin_10
#define BlueLED GPIO_Pin_11
#define Buzzer GPIO_Pin_5
// Function Prototype
void InitializeSystem( void );
u32_t millis( void );
#endif // CONFIG_H_
There are two important functions in this file:
- InitializeSystem()
- millis()
Led's status when this program runs in development board can be seen below:
LED On |
LED Off |
No comments:
Post a Comment