aboutsummaryrefslogtreecommitdiff
path: root/stmhal/gccollect.c
diff options
context:
space:
mode:
authorDamien George2014-04-12 18:50:20 +0100
committerDamien George2014-04-12 18:50:20 +0100
commit82c7b1b1d5c8ce0467bd580a86d20c645cec17df (patch)
tree7145c24660279e83208689a93d74453fd37e26eb /stmhal/gccollect.c
parentb14f2a0ba33b5b6d852d60ea510e112011d52c20 (diff)
stmhal: Put a USB structure in ROM; GC doesn't scan the data segment.
Diffstat (limited to 'stmhal/gccollect.c')
-rw-r--r--stmhal/gccollect.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/stmhal/gccollect.c b/stmhal/gccollect.c
index e20e92de1..d40460d70 100644
--- a/stmhal/gccollect.c
+++ b/stmhal/gccollect.c
@@ -21,10 +21,9 @@ void gc_collect(void) {
// start the GC
gc_collect_start();
- // scan everything in RAM before the heap
- // this includes the data and bss segments
- // TODO possibly don't need to scan data, since all pointers should start out NULL and be in bss
- gc_collect_root((void**)&_ram_start, ((uint32_t)&_ebss - (uint32_t)&_ram_start) / sizeof(uint32_t));
+ // We need to scan everything in RAM that can hold a pointer.
+ // The data segment is used, but should not contain pointers, so we just scan the bss.
+ gc_collect_root((void**)&_sbss, ((uint32_t)&_ebss - (uint32_t)&_sbss) / sizeof(uint32_t));
// get the registers and the sp
machine_uint_t regs[10];