Академический Документы
Профессиональный Документы
Культура Документы
What is SmartFusion?
Proven FPGA fabric Complete ARM Cortex-M3 MCU subsystem...& its hard Programmable analog In a flash-based device In production now!
100 MHz 32-bit ARM Cortex-M3 processor Bus matrix with up to 16 Gbps throughput 10/100 Ethernet MAC SPI, I2C, UART, 32-bit Timers Up to 512 KB flash and 64 KB of SRAM External memory controller 8-channel DMA controller Up to 41 MSS I/Os
Programmable Analog
Analog compute engine (ACE) offloads CPU from analog tasks Voltage, current and temp monitors 12-bit (SAR) ADCs @ up to 600 Ksps Sigma-Delta DACs Up to ten 50 ns high-speed comparators Up to 32 analog inputs and 3 outputs
Proven flash-based FPGA fabric 60,000 to 500,000 system gates 350 MHz system performance Embedded SRAMs and FIFOs Up to 128 FPGA I/Os
Full-featured traditional FPGA design flow Industry-leading software IDEs for embedded design Simulation, timing and power analysis reduce debug time Debug through FlashPro or standard RealView header
MSS Configurator
Configure the MSS peripherals and I/Os Create or import hardware configuration Automatically generate drivers for peripherals Configure programmable analog components Enables connection of FPGA fabric designs and IP to MSS
www.Micrium.com
Hardware
www.Micrium.com
Real-Time Kernels
A kernel is a key RTOS component Essentially a task scheduler The glue that holds the other components together Application developers can use a real-time kernel to achieve deterministic performance Most common alternative is the foreground/background system
www.Micrium.com
A Foreground/Background Example
Background
int { Perform initializations; while (1) { ADC_Read(); SPI_Read(); USB_Packet(); LCD_Update(); Audio_Decode(); File_Write(); } } } main (void)
Foreground
void { Clear interrupt; Read packet; App_ISRUSB (void)
www.Micrium.com
A Kernel-Based Example
Tasks
void { while (1) { ADC_Read(); Sleep for 1 ms; } } void { while (1) { Wait for signal from ISR; USB_Packet(); } } App_TaskUSB (void *p_arg) } App_TaskADC (void *p_arg)
ISRs
void { Clear interrupt; Signal USB Task; App_ISRUSB (void)
www.Micrium.com
Tasks
C functions Usually periodic Can be treated almost as if they are separate programs Managed by the kernel
www.Micrium.com
Tasks (Cont.)
static void App_TaskExample (void *p_arg) { Perform initializations; while (1) { Work toward tasks goals; } }
www.Micrium.com
www.Micrium.com
www.Micrium.com
www.Micrium.com
= 0x04040404 = 0x05050505 = 0x06060606 = 0x07070707 = 0x08080808 = 0x09090909 = 0x10101010 = 0x11111111 = p_arg = 0x01010101 = 0x02020202 = 0x03030303 = 0x12121212 = OS_TaskReturn = task
xPSR = 0x01000000
www.Micrium.com
Task Creation
void OSTaskCreate (OS_TCB CPU_CHAR OS_TASK_PTR void OS_PRIO CPU_STK CPU_STK The tasks OS_STK_SIZE priority OS_MSG_QTY OS_TICK void OS_OPT OS_ERR *p_tcb, The tasks TCB *p_name, *p_task, *p_arg, The actual task prio, *p_stk_base, *p_stk_limit, The tasks stk_size, stack q_size, time_quanta, *p_ext, opt, *p_err);
www.Micrium.com
www.Micrium.com
Foreground/Background Scheduling
while (1) { ADC_Read(); LCD_Update(); SPI_Read(); USB_Packet(); LCD_Update(); Audio_Decode(); File_Write(); LCD_Update(); }
www.Micrium.com
Kernel Scheduling
The kernel is responsible for running tasks There are two common schemes Cooperative scheduling Preemptive scheduling
www.Micrium.com
Cooperative Scheduling
ISR
USB Task
ADC Task
The USB task cannot run until the ADC task completes
Time
www.Micrium.com
Preemptive Scheduling
ISR
Round-Robin Scheduling
Multiple tasks are assigned the same priority Kernel runs each task for a period of time set by the application developer
Task A
Task B
Task C
Time Quantum Time
www.Micrium.com
main (void)
void {
Synchronization in a Kernel
void { Perform initializations; while (1) { Pend on semaphore; Read packet; Send response; } } } App_TaskUSB (void *p_arg) void { Clear interrupt; Post semaphore; App_ISRUSB (void)
www.Micrium.com
Semaphores
Essentially counters A zero value indicates no activity A non-zero value indicates that events have taken place Two primary operations Pend: Wait for events to occur Post: Signal occurrence of events While one task is waiting, the kernel runs other tasks
www.Micrium.com
Event Flags
Another means of synchronization Implemented with 8-, 16-, or 32-bit variables Each bit corresponds to an event Pend and post operations Tasks can wait for multiple events to take place
www.Micrium.com
Interrupts must be disabled while the shared resource (the UART) is accessed
Re-enable interrupts; }
www.Micrium.com
www.Micrium.com
Mutexes
Implemented much like semaphores Counter is normally initialized to a value of one Only effective when used every time a shared resource is accessed May offer protection against priority inversion
www.Micrium.com
www.Micrium.com
www.Micrium.com
C/OS-III Example #1
www.Micrium.com
www.Micrium.com
Hardware
www.Micrium.com
4. Run FlashPro 5. Create New Project 6. Specify PDB file and program
MICRIUM\Software\EvalBoards\Actel\SmartFusionEvalKit\Hardware\SmartFusion.pdb
2009, Micrim, All Rights Reserved www.Micrium.com
2. Import examples 3. Set path and environment variables 4. Build first project, Ex1_OS 5. Open Debug Dialog
Jumper JP10 should be in M3 position
6. Run code
2009, Micrim, All Rights Reserved www.Micrium.com
app.c, main()
OSInit(&os_err); OSTaskCreate((OS_TCB (CPU_CHAR (OS_TASK_PTR (void (OS_PRIO (CPU_STK *)&App_TaskStartTCB, *)"Start", )App_TaskStart, *)0, )APP_CFG_TASK_START_PRIO, *)&App_TaskStartStk[0],
(CPU_STK_SIZE )APP_CFG_TASK_START_STK_SIZE_LIMIT, (CPU_STK_SIZE )APP_CFG_TASK_START_STK_SIZE, (OS_MSG_QTY (OS_TICK (void (OS_OPT (OS_ERR OSStart(&os_err);
2009, Micrim, All Rights Reserved www.Micrium.com
app.c, App_TaskStart()
/* Initializations */ App_TaskCreate(); App_ObjCreate(); while (DEF_TRUE) { BSP_LED_Toggle(1); OSTimeDlyHMSM(0u, 0u, 0, 100u, OS_OPT_TIME_HMSM_STRICT, &err); }
www.Micrium.com
C/OS-III Example #2
www.Micrium.com
C/Probe
www.Micrium.com
Contact Information
Sales questions:
Robert Langley, Sales Representative Phone: +1 954 217 2036 Ext. 104 E-mail: robert.langley@micrium.com
Other inquiries:
Matt Gordon, Sr. Applications Engineer Phone: +1 954 217 2036 Ext. 102 E-mail: matt.gordon@micrium.com
www.Micrium.com