tests-main.c File Reference

#include <stdio.h>
#include "atom.h"
#include "atomport-private.h"
#include "atomport-tests.h"
#include "atomtests.h"
#include "atomtimer.h"
#include "uart.h"
#include "stm8s.h"

Defines

#define IDLE_STACK_SIZE_BYTES   128
#define MAIN_STACK_SIZE_BYTES   256

Functions

NO_REG_SAVE void main (void)

Variables

int _stack

Define Documentation

#define IDLE_STACK_SIZE_BYTES   128

Referenced by main().

#define MAIN_STACK_SIZE_BYTES   256

Referenced by main().


Function Documentation

NO_REG_SAVE void main ( void   ) 

main

Program entry point.

Sets up the STM8 hardware resources (system tick timer interrupt) necessary for the OS to be started. Creates an application thread and starts the OS.

If the compiler supports it, stack space can be saved by preventing the function from saving registers on entry. This is because we are called directly by the C startup assembler, and know that we will never return from here. The NO_REG_SAVE macro is used to denote such functions in a compiler-agnostic way, though not all compilers support it.

Note: to protect OS structures and data during initialisation, interrupts must remain disabled until the first thread has been restored. They are reenabled at the very end of the first thread restore, at which point it is safe for a reschedule to take place.

First application thread successfully created. It is now possible to start the OS. Execution will not return from atomOSStart(), which will restore the context of our application thread and start executing it.

Note that interrupts are still disabled at this point. They will be enabled as we restore and execute our first thread in archFirstThreadRestore().

References archInitSystemTickTimer(), IDLE_STACK_SIZE_BYTES, int8_t, and MAIN_STACK_SIZE_BYTES.


Variable Documentation

int _stack

Generated on Fri Jun 4 01:00:01 2010 for atomthreads by  doxygen 1.6.1