Allow globals in reclaimed bluetooth memory (#2455)
This commit is contained in:
parent
97d7c679d0
commit
65e2cf18bf
@ -28,6 +28,9 @@ MicroBitEvent lastEvent;
|
|||||||
void platform_init() {
|
void platform_init() {
|
||||||
microbit_seed_random();
|
microbit_seed_random();
|
||||||
seedRandom(microbit_random(0x7fffffff));
|
seedRandom(microbit_random(0x7fffffff));
|
||||||
|
}
|
||||||
|
|
||||||
|
void initMicrobitGC() {
|
||||||
if (device_heap_size(1) > NON_GC_HEAP_RESERVATION + 4)
|
if (device_heap_size(1) > NON_GC_HEAP_RESERVATION + 4)
|
||||||
gcPreAllocateBlock(device_heap_size(1) - NON_GC_HEAP_RESERVATION);
|
gcPreAllocateBlock(device_heap_size(1) - NON_GC_HEAP_RESERVATION);
|
||||||
}
|
}
|
||||||
|
@ -54,12 +54,22 @@ static inline int max_(int a, int b) {
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void initMicrobitGC();
|
||||||
|
|
||||||
} // namespace pxt
|
} // namespace pxt
|
||||||
|
|
||||||
using namespace pxt;
|
using namespace pxt;
|
||||||
|
|
||||||
#define DEVICE_EVT_ANY 0
|
#define DEVICE_EVT_ANY 0
|
||||||
|
|
||||||
|
#undef PXT_MAIN
|
||||||
|
#define PXT_MAIN \
|
||||||
|
int main() { \
|
||||||
|
pxt::initMicrobitGC(); \
|
||||||
|
pxt::start(); \
|
||||||
|
return 0; \
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// vim: ts=2 sw=2 expandtab
|
// vim: ts=2 sw=2 expandtab
|
||||||
|
Loading…
Reference in New Issue
Block a user