freemyipod r428 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r427‎ | r428 | r429 >
Date:03:00, 16 January 2011
Author:farthen
Status:new
Tags:
Comment:
emCORE: I forgot embiosapp.h => emcoreapp.h
Modified paths:
  • /emcore/trunk/export/emcoreapp.h (added) (history)

Diff [purge]

Index: emcore/trunk/export/emcoreapp.h
@@ -0,0 +1,48 @@
 2+#include "syscallwrappers.h"
 3+
 4+
 5+#define EMCORE_APP_HEADER(threadnamestr, stacksizebytes, mainfunc, threadprio) \
 6+ extern char __bss_start; \
 7+ extern char __bss_end; \
 8+ void __emcore_init() \
 9+ { \
 10+ asm volatile("swi\t2\n\tldr\tr3, =__emcore_required_version\nldr\tr3, [r3]\n\t" \
 11+ "ldr\tr2, [r0]\n\tcmp\tr3, r2\n\tldrls\tr1, [r0,#4]\n\tcmpls\tr1, r3\n\t" \
 12+ "movhi\tr0, #0\n\tldrhi\tr1, =__emcore_incompatible_api_str\n\t" \
 13+ "swihi\t1\n\tldr\tr1, =__emcore_syscall\n\tstr\tr0, [r1]\n\t" \
 14+ ::: "r0", "r1", "r2", "r3", "r12", "lr", "cc", "memory"); \
 15+ memset(&__bss_start, 0, (&__bss_end) - (&__bss_start)); \
 16+ mainfunc(); \
 17+ } \
 18+ uint32_t __emcore_thread_stack[stacksizebytes >> 2] __attribute__((section(".stack"))); \
 19+ const char __emcore_thread_name[] = threadnamestr; \
 20+ struct emcore_app_header \
 21+ { \
 22+ char signature[8]; \
 23+ int version; \
 24+ void* baseaddr; \
 25+ int size; \
 26+ uint32_t crc32; \
 27+ void* stackaddr; \
 28+ int stacksize; \
 29+ void* entrypoint; \
 30+ const char* threadname; \
 31+ int threadtype; \
 32+ int threadpriority; \
 33+ } __emcore_executable_hdr __attribute__((section(".execheader"))) = \
 34+ { \
 35+ .signature = "emBIexec", \
 36+ .version = 0, \
 37+ .baseaddr = &__emcore_executable_hdr, \
 38+ .size = -1, \
 39+ .crc32 = 0, \
 40+ .stackaddr = __emcore_thread_stack, \
 41+ .stacksize = stacksizebytes, \
 42+ .entrypoint = __emcore_init, \
 43+ .threadname = __emcore_thread_name, \
 44+ .threadtype = 0, \
 45+ .threadpriority = threadprio \
 46+ }; \
 47+ struct emcore_syscall_table* __emcore_syscall __attribute__((section(".stack"))); \
 48+ const uint32_t __emcore_required_version = EMCORE_API_VERSION; \
 49+ const char __emcore_incompatible_api_str[] = "Incompatible API version!\nGot %d, need %d";