summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-01-29 19:21:17 +0000
committerDamien George <damien.p.george@gmail.com>2014-01-29 19:21:17 +0000
commit01fa4a91643702eb62645346991a41e52c1c8414 (patch)
treec19277cd1f61a6553b79d3e7a3163d2cf835fdb6
parent0347fbd2d541d6ede7d281e0b2f8c79d56c5f8be (diff)
downloadmicropython-01fa4a91643702eb62645346991a41e52c1c8414.tar.gz
micropython-01fa4a91643702eb62645346991a41e52c1c8414.zip
stm: Fix gccollect ram range.
-rw-r--r--stm/gccollect.c4
-rw-r--r--stm/main.c11
-rw-r--r--stm/stm32f405.ld5
3 files changed, 15 insertions, 5 deletions
diff --git a/stm/gccollect.c b/stm/gccollect.c
index cea0bc56eb..ada5493a23 100644
--- a/stm/gccollect.c
+++ b/stm/gccollect.c
@@ -13,10 +13,10 @@ void gc_helper_get_regs_and_clean_stack(machine_uint_t *regs, machine_uint_t hea
void gc_collect(void) {
uint32_t start = sys_tick_counter;
gc_collect_start();
- gc_collect_root((void**)&_ram_start, (&_heap_start - &_ram_start) / 4);
+ gc_collect_root((void**)&_ram_start, ((uint32_t)&_heap_start - (uint32_t)&_ram_start) / sizeof(uint32_t));
machine_uint_t regs[10];
gc_helper_get_regs_and_clean_stack(regs, (machine_uint_t)&_heap_end);
- gc_collect_root((void**)&_heap_end, (&_ram_end - &_heap_end) / 4); // will trace regs since they now live in this function on the stack
+ gc_collect_root((void**)&_heap_end, ((uint32_t)&_ram_end - (uint32_t)&_heap_end) / sizeof(uint32_t)); // will trace regs since they now live in this function on the stack
gc_collect_end();
uint32_t ticks = sys_tick_counter - start; // TODO implement a function that does this properly
diff --git a/stm/main.c b/stm/main.c
index 9f2b6d564a..5c2d3cf17e 100644
--- a/stm/main.c
+++ b/stm/main.c
@@ -174,15 +174,24 @@ static mp_obj_t pyb_info(void) {
extern void *_ebss;
extern void *_estack;
extern void *_etext;
+ printf("_etext=%p\n", &_etext);
printf("_sidata=%p\n", &_sidata);
printf("_sdata=%p\n", &_sdata);
printf("_edata=%p\n", &_edata);
printf("_sbss=%p\n", &_sbss);
printf("_ebss=%p\n", &_ebss);
printf("_estack=%p\n", &_estack);
- printf("_etext=%p\n", &_etext);
printf("_ram_start=%p\n", &_ram_start);
printf("_heap_start=%p\n", &_heap_start);
+ printf("_heap_end=%p\n", &_heap_end);
+ printf("_ram_end=%p\n", &_ram_end);
+ }
+
+ // qstr info
+ {
+ uint n_pool, n_qstr, n_str_data_bytes, n_total_bytes;
+ qstr_pool_info(&n_pool, &n_qstr, &n_str_data_bytes, &n_total_bytes);
+ printf("qstr:\n n_pool=%u\n n_qstr=%u\n n_str_data_bytes=%u\n n_total_bytes=%u\n", n_pool, n_qstr, n_str_data_bytes, n_total_bytes);
}
// GC info
diff --git a/stm/stm32f405.ld b/stm/stm32f405.ld
index 5cef201a9a..6c29a681ce 100644
--- a/stm/stm32f405.ld
+++ b/stm/stm32f405.ld
@@ -19,8 +19,9 @@ _minimum_heap_size = 16K;
/* top end of the stack */
_estack = ORIGIN(RAM) + LENGTH(RAM);
-_ram_end = 0x20020000;
-_heap_end = 0x2001c000;
+/* RAM extents for the garbage collector */
+_ram_end = ORIGIN(RAM) + LENGTH(RAM);
+_heap_end = 0x2001c000; /* tunable */
/* define output sections */
SECTIONS