Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
circuitpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
circuitpython
Commits
0004a84e
Commit
0004a84e
authored
Jan 24, 2014
by
Damien George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Move gc_collect to py/gc.c"
This reverts commit
a215b09c
.
parent
baba08bf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
27 deletions
+18
-27
py/gc.c
py/gc.c
+0
-16
stm/main.c
stm/main.c
+18
-7
stm/stm32f405.ld
stm/stm32f405.ld
+0
-4
No files found.
py/gc.c
View file @
0004a84e
...
...
@@ -187,22 +187,6 @@ void gc_collect_end(void) {
gc_sweep
();
}
extern
void
gc_helper_get_regs_and_clean_stack
(
machine_uint_t
*
regs
,
machine_uint_t
heap_end
);
void
gc_collect
(
void
)
{
extern
char
_ram_start
;
/* defined by linker script */
extern
char
_ram_end
;
/* defined by linker script */
extern
char
_heap_start
;
/* defined by linker script */
extern
char
_heap_end
;
/* defined by linker script */
gc_collect_start
();
gc_collect_root
((
void
**
)
&
_ram_start
,
(
&
_heap_start
-
&
_ram_start
)
/
4
);
machine_uint_t
regs
[
10
];
gc_helper_get_regs_and_clean_stack
(
regs
,
(
uint32_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_end
();
}
void
gc_info
(
gc_info_t
*
info
)
{
info
->
total
=
(
gc_pool_end
-
gc_pool_start
)
*
sizeof
(
machine_uint_t
);
info
->
used
=
0
;
...
...
stm/main.c
View file @
0004a84e
...
...
@@ -48,7 +48,6 @@
int
errno
;
extern
uint32_t
_heap_start
;
extern
uint32_t
_heap_end
;
static
FATFS
fatfs0
;
...
...
@@ -456,12 +455,21 @@ bool do_file(const char *filename) {
}
}
mp_obj_t
pyb_gc
(
void
)
{
uint32_t
start
,
ticks
;
#define RAM_START (0x20000000) // fixed for chip
#define HEAP_END (0x2001c000) // tunable
#define RAM_END (0x20020000) // fixed for chip
start
=
sys_tick_counter
;
gc_collect
();
ticks
=
sys_tick_counter
-
start
;
// TODO implement a function that does this properly
void
gc_helper_get_regs_and_clean_stack
(
machine_uint_t
*
regs
,
machine_uint_t
heap_end
);
void
gc_collect
(
void
)
{
uint32_t
start
=
sys_tick_counter
;
gc_collect_start
();
gc_collect_root
((
void
**
)
RAM_START
,
(((
uint32_t
)
&
_heap_start
)
-
RAM_START
)
/
4
);
machine_uint_t
regs
[
10
];
gc_helper_get_regs_and_clean_stack
(
regs
,
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_end
();
uint32_t
ticks
=
sys_tick_counter
-
start
;
// TODO implement a function that does this properly
if
(
0
)
{
// print GC info
...
...
@@ -472,7 +480,10 @@ mp_obj_t pyb_gc(void) {
printf
(
" %lu : %lu
\n
"
,
info
.
used
,
info
.
free
);
printf
(
" 1=%lu 2=%lu m=%lu
\n
"
,
info
.
num_1block
,
info
.
num_2block
,
info
.
max_block
);
}
}
mp_obj_t
pyb_gc
(
void
)
{
gc_collect
();
return
mp_const_none
;
}
...
...
@@ -598,7 +609,7 @@ int main(void) {
soft_reset:
// GC init
gc_init
(
&
_heap_start
,
&
_heap_end
);
gc_init
(
&
_heap_start
,
(
void
*
)
HEAP_END
);
// Micro Python init
qstr_init
();
...
...
stm/stm32f405.ld
View file @
0004a84e
...
...
@@ -19,10 +19,6 @@ _minimum_heap_size = 16K;
/* top end of the stack */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_ram_start = 0x20000000;
_ram_end = 0x20020000;
_heap_end = 0x2001c000;
/* define output sections */
SECTIONS
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment