Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

py: Wrap call with fb_alloc. #115

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions py/omvdummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
*/

/*
* This function is doesn't to do anything.
* It stay here to prevent the error when compiling
* a frozen module on openmv platform.
* It declared as weak function and when all compiled
* objects have been linked, it will override by
* the real 'fb_alloc_free_till_mark' function
* which in 'fb_alloc.c' files
* These functions don't to do anything.
* They are here to prevent an error when compiling
* a frozen module on the openmv platform.
* They are declared as weak functions and when all compiled
* objects have been linked, they will overridden by
* the real 'fb_alloc_mark' and 'fb_alloc_free_till_mark'
* functions in the 'fb_alloc.c' file.
*/
void __attribute__((weak)) fb_alloc_mark()
{
}
void __attribute__((weak)) fb_alloc_free_till_mark()
{
}
7 changes: 6 additions & 1 deletion py/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,12 @@ mp_obj_t mp_call_function_n_kw(mp_obj_t fun_in, size_t n_args, size_t n_kw, cons

// do the call
if (MP_OBJ_TYPE_HAS_SLOT(type, call)) {
return MP_OBJ_TYPE_GET_SLOT(type, call)(fun_in, n_args, n_kw, args);
extern void fb_alloc_mark();
extern void fb_alloc_free_till_mark();
fb_alloc_mark();
mp_obj_t result = MP_OBJ_TYPE_GET_SLOT(type, call)(fun_in, n_args, n_kw, args);
fb_alloc_free_till_mark();
return result;
}

#if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE
Expand Down
Loading