Contiki 2.6

memmap.h

Go to the documentation of this file.
00001 /** @file hal/micro/cortexm3/memmap.h
00002  * @brief STM32W108 series memory map definitions used by the full hal
00003  *
00004  * <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved.        -->
00005  */
00006 #ifndef __MEMMAP_H__
00007 #define __MEMMAP_H__
00008 
00009 // Include the chip specific definitions
00010 #ifndef LOADER
00011   #if defined (CORTEXM3_STM32W108)
00012     #include "hal/micro/cortexm3/stm32w108/memmap.h"
00013   #elif defined (CORTEXM3_STM32F103)
00014     #include "hal/micro/cortexm3/stm32f103ret/memmap.h"
00015   #else
00016     #error no appropriate micro defined
00017   #endif
00018 #endif
00019 
00020 //=============================================================================
00021 // A union that describes the entries of the vector table.  The union is needed
00022 // since the first entry is the stack pointer and the remainder are function
00023 // pointers.
00024 //
00025 // Normally the vectorTable below would require entries such as:
00026 //   { .topOfStack = x },
00027 //   { .ptrToHandler = y },
00028 // But since ptrToHandler is defined first in the union, this is the default
00029 // type which means we don't need to use the full, explicit entry.  This makes
00030 // the vector table easier to read because it's simply a list of the handler
00031 // functions.  topOfStack, though, is the second definition in the union so
00032 // the full entry must be used in the vectorTable.
00033 //=============================================================================
00034 typedef union
00035 {
00036   void (*ptrToHandler)(void);
00037   void *topOfStack;
00038 } HalVectorTableType;
00039 
00040 
00041 // ****************************************************************************
00042 // If any of these address table definitions ever need to change, it is highly
00043 // desirable to only add new entries, and only add them on to the end of an
00044 // existing address table... this will provide the best compatibility with
00045 // any existing code which may utilize the tables, and which may not be able to 
00046 // be updated to understand a new format (example: bootloader which reads the 
00047 // application address table)
00048 
00049 // Generic Address table definition which describes leading fields which
00050 // are common to all address table types
00051 typedef struct {
00052   void *topOfStack;
00053   void (*resetVector)(void);
00054   void (*nmiHandler)(void);
00055   void (*hardFaultHandler)(void);
00056   int16u type;
00057   int16u version;
00058   const HalVectorTableType *vectorTable;
00059   // Followed by more fields depending on the specific address table type
00060 } HalBaseAddressTableType;
00061 
00062 // Hal only references the FAT
00063 #include "memmap-fat.h"
00064 
00065 #endif //__MEMMMAP_H__
00066