PokittoLib is the library needed for programming the Pokitto DIY game console (www.pokitto.com)

Committer:
Pokitto
Date:
Wed Oct 11 20:35:27 2017 +0000
Revision:
5:ea7377f3d1af
Fixed PokittoLib. Includes a working custom mbed-src

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Pokitto 5:ea7377f3d1af 1 /* mbed Microcontroller Library - stackheap
Pokitto 5:ea7377f3d1af 2 * Copyright (C) 2009-2011 ARM Limited. All rights reserved.
Pokitto 5:ea7377f3d1af 3 *
Pokitto 5:ea7377f3d1af 4 * Setup a fixed single stack/heap memory model,
Pokitto 5:ea7377f3d1af 5 * between the top of the RW/ZI region and the stackpointer
Pokitto 5:ea7377f3d1af 6 */
Pokitto 5:ea7377f3d1af 7
Pokitto 5:ea7377f3d1af 8 #ifdef __cplusplus
Pokitto 5:ea7377f3d1af 9 extern "C" {
Pokitto 5:ea7377f3d1af 10 #endif
Pokitto 5:ea7377f3d1af 11
Pokitto 5:ea7377f3d1af 12 #include <rt_misc.h>
Pokitto 5:ea7377f3d1af 13 #include <stdint.h>
Pokitto 5:ea7377f3d1af 14
Pokitto 5:ea7377f3d1af 15 extern char Image$$RW_IRAM1$$ZI$$Limit[];
Pokitto 5:ea7377f3d1af 16
Pokitto 5:ea7377f3d1af 17 extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
Pokitto 5:ea7377f3d1af 18 uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
Pokitto 5:ea7377f3d1af 19 uint32_t sp_limit = __current_sp();
Pokitto 5:ea7377f3d1af 20
Pokitto 5:ea7377f3d1af 21 zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned
Pokitto 5:ea7377f3d1af 22
Pokitto 5:ea7377f3d1af 23 struct __initial_stackheap r;
Pokitto 5:ea7377f3d1af 24 r.heap_base = zi_limit;
Pokitto 5:ea7377f3d1af 25 r.heap_limit = sp_limit;
Pokitto 5:ea7377f3d1af 26 return r;
Pokitto 5:ea7377f3d1af 27 }
Pokitto 5:ea7377f3d1af 28
Pokitto 5:ea7377f3d1af 29 #ifdef __cplusplus
Pokitto 5:ea7377f3d1af 30 }
Pokitto 5:ea7377f3d1af 31 #endif