Commit f08164aa authored by George Wort's avatar George Wort

Set file system size.

parent faf2f098
......@@ -28,7 +28,7 @@
#define __MICROPY_INCLUDED_MEMORY_H__
#include "microbit/filesystem.h"
#include "emscripten.h"
static inline char *rounddown(char *addr, uint32_t align) {
return (char *)(((uint32_t)addr)&(-align));
......@@ -38,19 +38,28 @@ static inline char *roundup(char *addr, uint32_t align) {
return (char *)((((uint32_t)addr)+align-1)&(-align));
}
char rom[0x6400] __attribute__((aligned(MBED_CONF_APP_MICROBIT_PAGE_SIZE)));
static uint32_t end_of_code = 0;
#define ROM_SIZE ((CHUNK_SIZE * MAX_CHUNKS_IN_FILE_SYSTEM) + (2 * MBED_CONF_APP_MICROBIT_PAGE_SIZE))
static char rom[ROM_SIZE] __attribute__((aligned(MBED_CONF_APP_MICROBIT_PAGE_SIZE)));
EMSCRIPTEN_KEEPALIVE
void set_filesystem_size(uint32_t size) {
int32_t temp = ROM_SIZE - size;
end_of_code = temp < 0 ? 0 : temp;
}
/** The end of the code area in flash ROM (text plus read-only copy of data area) */
static inline char *microbit_end_of_code() {
return &rom[0x0]; // 0x39C00 - 0x39C00
return &rom[end_of_code];
}
static inline char *microbit_end_of_rom() {
return &rom[0x6400]; // 0x40000 - 0x39C00
return &rom[ROM_SIZE];
}
static inline char *microbit_mp_appended_script() {
return &rom[0x4400]; // 0x3e000 - 0x39C00
return &rom[ROM_SIZE - (8 * MBED_CONF_APP_MICROBIT_PAGE_SIZE)];
}
static inline void *microbit_compass_calibration_page(void) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment