Allow globals in reclaimed bluetooth memory (#2455)

This commit is contained in:
Michał Moskal 2019-10-02 07:37:38 +02:00 committed by Peli de Halleux
parent 97d7c679d0
commit 65e2cf18bf
2 changed files with 13 additions and 0 deletions

View File

@ -28,6 +28,9 @@ MicroBitEvent lastEvent;
void platform_init() {
microbit_seed_random();
seedRandom(microbit_random(0x7fffffff));
}
void initMicrobitGC() {
if (device_heap_size(1) > NON_GC_HEAP_RESERVATION + 4)
gcPreAllocateBlock(device_heap_size(1) - NON_GC_HEAP_RESERVATION);
}

View File

@ -54,12 +54,22 @@ static inline int max_(int a, int b) {
return b;
}
void initMicrobitGC();
} // namespace pxt
using namespace pxt;
#define DEVICE_EVT_ANY 0
#undef PXT_MAIN
#define PXT_MAIN \
int main() { \
pxt::initMicrobitGC(); \
pxt::start(); \
return 0; \
}
#endif
// vim: ts=2 sw=2 expandtab