diff --git a/extmod/moductypes.c b/extmod/moductypes.c
index b8f68bf8c1c6bf4244e55908ab104935847c29ac..4d2e3f696468d53f6243564f8a935ebd783e6258 100644
--- a/extmod/moductypes.c
+++ b/extmod/moductypes.c
@@ -559,7 +559,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_ob
 /// \function addressof()
 /// Return address of object's data (applies to object providing buffer
 /// interface).
-mp_obj_t uctypes_struct_addressof(mp_obj_t buf) {
+STATIC mp_obj_t uctypes_struct_addressof(mp_obj_t buf) {
     mp_buffer_info_t bufinfo;
     mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ);
     return mp_obj_new_int((mp_int_t)bufinfo.buf);
@@ -570,7 +570,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(uctypes_struct_addressof_obj, uctypes_struct_addressof
 /// Capture memory at given address of given size as bytearray. Memory is
 /// captured by reference (and thus memory pointed by bytearray may change
 /// or become invalid at later time). Use bytes_at() to capture by value.
-mp_obj_t uctypes_struct_bytearray_at(mp_obj_t ptr, mp_obj_t size) {
+STATIC mp_obj_t uctypes_struct_bytearray_at(mp_obj_t ptr, mp_obj_t size) {
     return mp_obj_new_bytearray_by_ref(mp_obj_int_get_truncated(size), (void*)mp_obj_int_get_truncated(ptr));
 }
 MP_DEFINE_CONST_FUN_OBJ_2(uctypes_struct_bytearray_at_obj, uctypes_struct_bytearray_at);
@@ -579,7 +579,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(uctypes_struct_bytearray_at_obj, uctypes_struct_bytear
 /// Capture memory at given address of given size as bytes. Memory is
 /// captured by value, i.e. copied. Use bytearray_at() to capture by reference
 /// ("zero copy").
-mp_obj_t uctypes_struct_bytes_at(mp_obj_t ptr, mp_obj_t size) {
+STATIC mp_obj_t uctypes_struct_bytes_at(mp_obj_t ptr, mp_obj_t size) {
     return mp_obj_new_bytes((void*)mp_obj_int_get_truncated(ptr), mp_obj_int_get_truncated(size));
 }
 MP_DEFINE_CONST_FUN_OBJ_2(uctypes_struct_bytes_at_obj, uctypes_struct_bytes_at);
diff --git a/extmod/modure.c b/extmod/modure.c
index 910166249cec1382df95544fa1e254d4e7002e79..b9f26245636ea0208a3e01599a68b0183951cd1b 100644
--- a/extmod/modure.c
+++ b/extmod/modure.c
@@ -175,7 +175,7 @@ STATIC const mp_obj_type_t re_type = {
     .locals_dict = (mp_obj_t)&re_locals_dict,
 };
 
-mp_obj_t mod_re_compile(uint n_args, const mp_obj_t *args) {
+STATIC mp_obj_t mod_re_compile(uint n_args, const mp_obj_t *args) {
     const char *re_str = mp_obj_str_get_str(args[0]);
     int size = re1_5_sizecode(re_str);
     mp_obj_re_t *o = m_new_obj_var(mp_obj_re_t, char, size);
diff --git a/py/asmx86.c b/py/asmx86.c
index 01966a2626dd6127554e55bd318ea5289de9399a..f0dc1e60f5d53193138dd0781b8d0b1b0fb2e7f5 100644
--- a/py/asmx86.c
+++ b/py/asmx86.c
@@ -325,7 +325,7 @@ void asm_x86_add_r32_r32(asm_x86_t *as, int dest_r32, int src_r32) {
     asm_x86_generic_r32_r32(as, dest_r32, src_r32, OPCODE_ADD_R32_TO_RM32);
 }
 
-void asm_x86_add_i32_to_r32(asm_x86_t *as, int src_i32, int dest_r32) {
+STATIC void asm_x86_add_i32_to_r32(asm_x86_t *as, int src_i32, int dest_r32) {
     if (SIGNED_FIT8(src_i32)) {
         asm_x86_write_byte_2(as, OPCODE_ADD_I8_TO_RM32, MODRM_R32(0) | MODRM_RM_REG | MODRM_RM_R32(dest_r32));
         asm_x86_write_byte_1(as, src_i32 & 0xff);
diff --git a/py/compile.c b/py/compile.c
index 3633503958e6682532cd0bdfbd620d9dae5071b3..25a4c960e7b659602db2fb8083db151ed78b9c70 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -429,10 +429,7 @@ STATIC int list_get(mp_parse_node_t *pn, int pn_kind, mp_parse_node_t **nodes) {
     }
 }
 
-void compile_do_nothing(compiler_t *comp, mp_parse_node_struct_t *pns) {
-}
-
-void compile_generic_all_nodes(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_generic_all_nodes(compiler_t *comp, mp_parse_node_struct_t *pns) {
     int num_nodes = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
     for (int i = 0; i < num_nodes; i++) {
         compile_node(comp, pns->nodes[i]);
@@ -602,7 +599,7 @@ STATIC void c_tuple(compiler_t *comp, mp_parse_node_t pn, mp_parse_node_struct_t
 #endif
 }
 
-void compile_generic_tuple(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_generic_tuple(compiler_t *comp, mp_parse_node_struct_t *pns) {
     // a simple tuple expression
     c_tuple(comp, MP_PARSE_NODE_NULL, pns);
 }
@@ -1100,7 +1097,7 @@ STATIC void compile_funcdef_param(compiler_t *comp, mp_parse_node_t pn) {
 
 // leaves function object on stack
 // returns function name
-qstr compile_funcdef_helper(compiler_t *comp, mp_parse_node_struct_t *pns, uint emit_options) {
+STATIC qstr compile_funcdef_helper(compiler_t *comp, mp_parse_node_struct_t *pns, uint emit_options) {
     if (comp->pass == MP_PASS_SCOPE) {
         // create a new scope for this function
         scope_t *s = scope_new_and_link(comp, SCOPE_FUNCTION, (mp_parse_node_t)pns, emit_options);
@@ -1149,7 +1146,7 @@ qstr compile_funcdef_helper(compiler_t *comp, mp_parse_node_struct_t *pns, uint
 
 // leaves class object on stack
 // returns class name
-qstr compile_classdef_helper(compiler_t *comp, mp_parse_node_struct_t *pns, uint emit_options) {
+STATIC qstr compile_classdef_helper(compiler_t *comp, mp_parse_node_struct_t *pns, uint emit_options) {
     if (comp->pass == MP_PASS_SCOPE) {
         // create a new scope for this class
         scope_t *s = scope_new_and_link(comp, SCOPE_CLASS, (mp_parse_node_t)pns, emit_options);
@@ -1212,7 +1209,7 @@ STATIC bool compile_built_in_decorator(compiler_t *comp, int name_len, mp_parse_
     return true;
 }
 
-void compile_decorated(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_decorated(compiler_t *comp, mp_parse_node_struct_t *pns) {
     // get the list of decorators
     mp_parse_node_t *nodes;
     int n = list_get(&pns->nodes[0], PN_decorators, &nodes);
@@ -1275,7 +1272,7 @@ void compile_decorated(compiler_t *comp, mp_parse_node_struct_t *pns) {
     EMIT_ARG(store_id, body_name);
 }
 
-void compile_funcdef(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_funcdef(compiler_t *comp, mp_parse_node_struct_t *pns) {
     qstr fname = compile_funcdef_helper(comp, pns, comp->scope_cur->emit_options);
     // store function object into function name
     EMIT_ARG(store_id, fname);
@@ -1365,11 +1362,11 @@ cannot_delete:
     compile_syntax_error(comp, (mp_parse_node_t)pn, "can't delete expression");
 }
 
-void compile_del_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_del_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     apply_to_single_or_list(comp, pns->nodes[0], PN_exprlist, c_del_stmt);
 }
 
-void compile_break_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_break_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     if (comp->break_label == 0) {
         compile_syntax_error(comp, (mp_parse_node_t)pns, "'break' outside loop");
     }
@@ -1377,7 +1374,7 @@ void compile_break_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     EMIT_ARG(break_loop, comp->break_label, comp->cur_except_level - comp->break_continue_except_level);
 }
 
-void compile_continue_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_continue_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     if (comp->continue_label == 0) {
         compile_syntax_error(comp, (mp_parse_node_t)pns, "'continue' outside loop");
     }
@@ -1385,7 +1382,7 @@ void compile_continue_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     EMIT_ARG(continue_loop, comp->continue_label, comp->cur_except_level - comp->break_continue_except_level);
 }
 
-void compile_return_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_return_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     if (comp->scope_cur->kind != SCOPE_FUNCTION) {
         compile_syntax_error(comp, (mp_parse_node_t)pns, "'return' outside function");
         return;
@@ -1410,12 +1407,12 @@ void compile_return_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     EMIT(return_value);
 }
 
-void compile_yield_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_yield_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     compile_node(comp, pns->nodes[0]);
     EMIT(pop_top);
 }
 
-void compile_raise_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_raise_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     if (MP_PARSE_NODE_IS_NULL(pns->nodes[0])) {
         // raise
         EMIT_ARG(raise_varargs, 0);
@@ -1503,11 +1500,11 @@ STATIC void compile_dotted_as_name(compiler_t *comp, mp_parse_node_t pn) {
     EMIT_ARG(store_id, q_base);
 }
 
-void compile_import_name(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_import_name(compiler_t *comp, mp_parse_node_struct_t *pns) {
     apply_to_single_or_list(comp, pns->nodes[0], PN_dotted_as_names, compile_dotted_as_name);
 }
 
-void compile_import_from(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_import_from(compiler_t *comp, mp_parse_node_struct_t *pns) {
     mp_parse_node_t pn_import_source = pns->nodes[0];
 
     // extract the preceeding .'s (if any) for a relative import, to compute the import level
@@ -1618,7 +1615,7 @@ void compile_import_from(compiler_t *comp, mp_parse_node_struct_t *pns) {
     }
 }
 
-void compile_global_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_global_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     if (comp->pass == MP_PASS_SCOPE) {
         if (MP_PARSE_NODE_IS_LEAF(pns->nodes[0])) {
             scope_declare_global(comp->scope_cur, MP_PARSE_NODE_LEAF_ARG(pns->nodes[0]));
@@ -1632,7 +1629,7 @@ void compile_global_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     }
 }
 
-void compile_nonlocal_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_nonlocal_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     if (comp->pass == MP_PASS_SCOPE) {
         if (MP_PARSE_NODE_IS_LEAF(pns->nodes[0])) {
             scope_declare_nonlocal(comp->scope_cur, MP_PARSE_NODE_LEAF_ARG(pns->nodes[0]));
@@ -1646,7 +1643,7 @@ void compile_nonlocal_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     }
 }
 
-void compile_assert_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_assert_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     uint l_end = comp_next_label(comp);
     c_if_cond(comp, pns->nodes[0], true, l_end);
     EMIT_ARG(load_global, MP_QSTR_AssertionError); // we load_global instead of load_id, to be consistent with CPython
@@ -1659,7 +1656,7 @@ void compile_assert_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     EMIT_ARG(label_assign, l_end);
 }
 
-void compile_if_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_if_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     // TODO proper and/or short circuiting
 
     uint l_end = comp_next_label(comp);
@@ -1738,7 +1735,7 @@ done:
     comp->continue_label = old_continue_label; \
     comp->break_continue_except_level = old_break_continue_except_level;
 
-void compile_while_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_while_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     START_BREAK_CONTINUE_BLOCK
 
     // compared to CPython, we have an optimised version of while loops
@@ -1837,7 +1834,7 @@ STATIC void compile_for_stmt_optimised_range(compiler_t *comp, mp_parse_node_t p
 }
 #endif
 
-void compile_for_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_for_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
 #if !MICROPY_EMIT_CPYTHON
     // this bit optimises: for <x> in range(...), turning it into an explicitly incremented variable
     // this is actually slower, but uses no heap memory
@@ -2034,7 +2031,7 @@ STATIC void compile_try_finally(compiler_t *comp, mp_parse_node_t pn_body, int n
     EMIT(end_finally);
 }
 
-void compile_try_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_try_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     if (MP_PARSE_NODE_IS_STRUCT(pns->nodes[1])) {
         mp_parse_node_struct_t *pns2 = (mp_parse_node_struct_t*)pns->nodes[1];
         if (MP_PARSE_NODE_STRUCT_KIND(pns2) == PN_try_stmt_finally) {
@@ -2094,7 +2091,7 @@ STATIC void compile_with_stmt_helper(compiler_t *comp, int n, mp_parse_node_t *n
     }
 }
 
-void compile_with_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_with_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     // get the nodes for the pre-bit of the with (the a as b, c as d, ... bit)
     mp_parse_node_t *nodes;
     int n = list_get(&pns->nodes[0], PN_with_stmt_list, &nodes);
@@ -2104,7 +2101,7 @@ void compile_with_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     compile_with_stmt_helper(comp, n, nodes, pns->nodes[1]);
 }
 
-void compile_expr_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_expr_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
     if (MP_PARSE_NODE_IS_NULL(pns->nodes[1])) {
         if (comp->is_repl && comp->scope_cur->kind == SCOPE_MODULE) {
             // for REPL, evaluate then print the expression
@@ -2222,7 +2219,7 @@ STATIC void c_binary_op(compiler_t *comp, mp_parse_node_struct_t *pns, mp_binary
     }
 }
 
-void compile_test_if_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_test_if_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
     assert(MP_PARSE_NODE_IS_STRUCT_KIND(pns->nodes[1], PN_test_if_else));
     mp_parse_node_struct_t *pns_test_if_else = (mp_parse_node_struct_t*)pns->nodes[1];
 
@@ -2237,7 +2234,7 @@ void compile_test_if_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
     EMIT_ARG(label_assign, l_end);
 }
 
-void compile_lambdef(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_lambdef(compiler_t *comp, mp_parse_node_struct_t *pns) {
     // TODO default params etc for lambda; possibly just use funcdef code
     //mp_parse_node_t pn_params = pns->nodes[0];
     //mp_parse_node_t pn_body = pns->nodes[1];
@@ -2256,7 +2253,7 @@ void compile_lambdef(compiler_t *comp, mp_parse_node_struct_t *pns) {
     close_over_variables_etc(comp, this_scope, 0, 0);
 }
 
-void compile_or_test(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_or_test(compiler_t *comp, mp_parse_node_struct_t *pns) {
     uint l_end = comp_next_label(comp);
     int n = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
     for (int i = 0; i < n; i += 1) {
@@ -2268,7 +2265,7 @@ void compile_or_test(compiler_t *comp, mp_parse_node_struct_t *pns) {
     EMIT_ARG(label_assign, l_end);
 }
 
-void compile_and_test(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_and_test(compiler_t *comp, mp_parse_node_struct_t *pns) {
     uint l_end = comp_next_label(comp);
     int n = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
     for (int i = 0; i < n; i += 1) {
@@ -2280,12 +2277,12 @@ void compile_and_test(compiler_t *comp, mp_parse_node_struct_t *pns) {
     EMIT_ARG(label_assign, l_end);
 }
 
-void compile_not_test_2(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_not_test_2(compiler_t *comp, mp_parse_node_struct_t *pns) {
     compile_node(comp, pns->nodes[0]);
     EMIT_ARG(unary_op, MP_UNARY_OP_NOT);
 }
 
-void compile_comparison(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_comparison(compiler_t *comp, mp_parse_node_struct_t *pns) {
     int num_nodes = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
     compile_node(comp, pns->nodes[0]);
     bool multi = (num_nodes > 3);
@@ -2346,23 +2343,23 @@ void compile_comparison(compiler_t *comp, mp_parse_node_struct_t *pns) {
     }
 }
 
-void compile_star_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_star_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
     compile_syntax_error(comp, (mp_parse_node_t)pns, "*x must be assignment target");
 }
 
-void compile_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
     c_binary_op(comp, pns, MP_BINARY_OP_OR);
 }
 
-void compile_xor_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_xor_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
     c_binary_op(comp, pns, MP_BINARY_OP_XOR);
 }
 
-void compile_and_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_and_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
     c_binary_op(comp, pns, MP_BINARY_OP_AND);
 }
 
-void compile_shift_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_shift_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
     int num_nodes = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
     compile_node(comp, pns->nodes[0]);
     for (int i = 1; i + 1 < num_nodes; i += 2) {
@@ -2378,7 +2375,7 @@ void compile_shift_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
     }
 }
 
-void compile_arith_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_arith_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
     int num_nodes = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
     compile_node(comp, pns->nodes[0]);
     for (int i = 1; i + 1 < num_nodes; i += 2) {
@@ -2394,7 +2391,7 @@ void compile_arith_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
     }
 }
 
-void compile_term(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_term(compiler_t *comp, mp_parse_node_struct_t *pns) {
     int num_nodes = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
     compile_node(comp, pns->nodes[0]);
     for (int i = 1; i + 1 < num_nodes; i += 2) {
@@ -2414,7 +2411,7 @@ void compile_term(compiler_t *comp, mp_parse_node_struct_t *pns) {
     }
 }
 
-void compile_factor_2(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_factor_2(compiler_t *comp, mp_parse_node_struct_t *pns) {
     compile_node(comp, pns->nodes[1]);
     if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[0], MP_TOKEN_OP_PLUS)) {
         EMIT_ARG(unary_op, MP_UNARY_OP_POSITIVE);
@@ -2428,7 +2425,7 @@ void compile_factor_2(compiler_t *comp, mp_parse_node_struct_t *pns) {
     }
 }
 
-void compile_power(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_power(compiler_t *comp, mp_parse_node_struct_t *pns) {
     // this is to handle special super() call
     comp->func_arg_is_super = MP_PARSE_NODE_IS_ID(pns->nodes[0]) && MP_PARSE_NODE_LEAF_ARG(pns->nodes[0]) == MP_QSTR_super;
 
@@ -2526,7 +2523,7 @@ STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_ar
     }
 }
 
-void compile_power_trailers(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_power_trailers(compiler_t *comp, mp_parse_node_struct_t *pns) {
     int num_nodes = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
     for (int i = 0; i < num_nodes; i++) {
         if (i + 1 < num_nodes && MP_PARSE_NODE_IS_STRUCT_KIND(pns->nodes[i], PN_trailer_period) && MP_PARSE_NODE_IS_STRUCT_KIND(pns->nodes[i + 1], PN_trailer_paren)) {
@@ -2543,12 +2540,12 @@ void compile_power_trailers(compiler_t *comp, mp_parse_node_struct_t *pns) {
     }
 }
 
-void compile_power_dbl_star(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_power_dbl_star(compiler_t *comp, mp_parse_node_struct_t *pns) {
     compile_node(comp, pns->nodes[0]);
     EMIT_ARG(binary_op, MP_BINARY_OP_POWER);
 }
 
-void compile_atom_string(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_atom_string(compiler_t *comp, mp_parse_node_struct_t *pns) {
     // a list of strings
 
     // check type of list (string or bytes) and count total number of bytes
@@ -2620,7 +2617,7 @@ STATIC void compile_comprehension(compiler_t *comp, mp_parse_node_struct_t *pns,
     EMIT_ARG(call_function, 1, 0, 0);
 }
 
-void compile_atom_paren(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_atom_paren(compiler_t *comp, mp_parse_node_struct_t *pns) {
     if (MP_PARSE_NODE_IS_NULL(pns->nodes[0])) {
         // an empty tuple
         c_tuple(comp, MP_PARSE_NODE_NULL, NULL);
@@ -2654,7 +2651,7 @@ void compile_atom_paren(compiler_t *comp, mp_parse_node_struct_t *pns) {
     }
 }
 
-void compile_atom_bracket(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_atom_bracket(compiler_t *comp, mp_parse_node_struct_t *pns) {
     if (MP_PARSE_NODE_IS_NULL(pns->nodes[0])) {
         // empty list
         EMIT_ARG(build_list, 0);
@@ -2693,7 +2690,7 @@ void compile_atom_bracket(compiler_t *comp, mp_parse_node_struct_t *pns) {
     }
 }
 
-void compile_atom_brace(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_atom_brace(compiler_t *comp, mp_parse_node_struct_t *pns) {
     mp_parse_node_t pn = pns->nodes[0];
     if (MP_PARSE_NODE_IS_NULL(pn)) {
         // empty dict
@@ -2777,22 +2774,22 @@ void compile_atom_brace(compiler_t *comp, mp_parse_node_struct_t *pns) {
     }
 }
 
-void compile_trailer_paren(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_trailer_paren(compiler_t *comp, mp_parse_node_struct_t *pns) {
     compile_trailer_paren_helper(comp, pns->nodes[0], false, 0);
 }
 
-void compile_trailer_bracket(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_trailer_bracket(compiler_t *comp, mp_parse_node_struct_t *pns) {
     // object who's index we want is on top of stack
     compile_node(comp, pns->nodes[0]); // the index
     EMIT(load_subscr);
 }
 
-void compile_trailer_period(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_trailer_period(compiler_t *comp, mp_parse_node_struct_t *pns) {
     // object who's attribute we want is on top of stack
     EMIT_ARG(load_attr, MP_PARSE_NODE_LEAF_ARG(pns->nodes[0])); // attribute to get
 }
 
-void compile_subscript_3_helper(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_subscript_3_helper(compiler_t *comp, mp_parse_node_struct_t *pns) {
     assert(MP_PARSE_NODE_STRUCT_KIND(pns) == PN_subscript_3); // should always be
     mp_parse_node_t pn = pns->nodes[0];
     if (MP_PARSE_NODE_IS_NULL(pn)) {
@@ -2837,30 +2834,30 @@ void compile_subscript_3_helper(compiler_t *comp, mp_parse_node_struct_t *pns) {
     }
 }
 
-void compile_subscript_2(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_subscript_2(compiler_t *comp, mp_parse_node_struct_t *pns) {
     compile_node(comp, pns->nodes[0]); // start of slice
     assert(MP_PARSE_NODE_IS_STRUCT(pns->nodes[1])); // should always be
     compile_subscript_3_helper(comp, (mp_parse_node_struct_t*)pns->nodes[1]);
 }
 
-void compile_subscript_3(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_subscript_3(compiler_t *comp, mp_parse_node_struct_t *pns) {
     EMIT_ARG(load_const_tok, MP_TOKEN_KW_NONE);
     compile_subscript_3_helper(comp, pns);
 }
 
-void compile_dictorsetmaker_item(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_dictorsetmaker_item(compiler_t *comp, mp_parse_node_struct_t *pns) {
     // if this is called then we are compiling a dict key:value pair
     compile_node(comp, pns->nodes[1]); // value
     compile_node(comp, pns->nodes[0]); // key
 }
 
-void compile_classdef(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_classdef(compiler_t *comp, mp_parse_node_struct_t *pns) {
     qstr cname = compile_classdef_helper(comp, pns, comp->scope_cur->emit_options);
     // store class object into class name
     EMIT_ARG(store_id, cname);
 }
 
-void compile_yield_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_yield_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
     if (comp->scope_cur->kind != SCOPE_FUNCTION && comp->scope_cur->kind != SCOPE_LAMBDA) {
         compile_syntax_error(comp, (mp_parse_node_t)pns, "'yield' outside function");
         return;
diff --git a/py/emitinlinethumb.c b/py/emitinlinethumb.c
index 09342f1f90ff1c9128ff82a692191d51aea2c1ff..c0beaef61ef3735030c170817451f9425fc93f43 100644
--- a/py/emitinlinethumb.c
+++ b/py/emitinlinethumb.c
@@ -61,7 +61,7 @@ struct _emit_inline_asm_t {
     asm_thumb_t *as;
 };
 
-void emit_inline_thumb_error(emit_inline_asm_t *emit, const char *fmt, ...) {
+STATIC void emit_inline_thumb_error(emit_inline_asm_t *emit, const char *fmt, ...) {
     printf("SyntaxError: ");
     emit->success = false;
     va_list ap;
diff --git a/py/modcmath.c b/py/modcmath.c
index 4cd3a82359398a0c013764ae7c738508e20d27f9..7514a8c029166cc4e4ea9b5348a2987a773758af 100644
--- a/py/modcmath.c
+++ b/py/modcmath.c
@@ -47,7 +47,7 @@ extern const mp_obj_float_t mp_math_pi_obj;
 
 /// \function phase(z)
 /// Returns the phase of the number `z`, in the range (-pi, +pi].
-mp_obj_t mp_cmath_phase(mp_obj_t z_obj) {
+STATIC mp_obj_t mp_cmath_phase(mp_obj_t z_obj) {
     mp_float_t real, imag;
     mp_obj_get_complex(z_obj, &real, &imag);
     return mp_obj_new_float(MICROPY_FLOAT_C_FUN(atan2)(imag, real));
@@ -56,7 +56,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_phase_obj, mp_cmath_phase);
 
 /// \function polar(z)
 /// Returns, as a tuple, the polar form of `z`.
-mp_obj_t mp_cmath_polar(mp_obj_t z_obj) {
+STATIC mp_obj_t mp_cmath_polar(mp_obj_t z_obj) {
     mp_float_t real, imag;
     mp_obj_get_complex(z_obj, &real, &imag);
     mp_obj_t tuple[2] = {
@@ -69,7 +69,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_polar_obj, mp_cmath_polar);
 
 /// \function rect(r, phi)
 /// Returns the complex number with modulus `r` and phase `phi`.
-mp_obj_t mp_cmath_rect(mp_obj_t r_obj, mp_obj_t phi_obj) {
+STATIC mp_obj_t mp_cmath_rect(mp_obj_t r_obj, mp_obj_t phi_obj) {
     mp_float_t r = mp_obj_get_float(r_obj);
     mp_float_t phi = mp_obj_get_float(phi_obj);
     return mp_obj_new_complex(r * MICROPY_FLOAT_C_FUN(cos)(phi), r * MICROPY_FLOAT_C_FUN(sin)(phi));
@@ -78,7 +78,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_cmath_rect_obj, mp_cmath_rect);
 
 /// \function exp(z)
 /// Return the exponential of `z`.
-mp_obj_t mp_cmath_exp(mp_obj_t z_obj) {
+STATIC mp_obj_t mp_cmath_exp(mp_obj_t z_obj) {
     mp_float_t real, imag;
     mp_obj_get_complex(z_obj, &real, &imag);
     mp_float_t exp_real = MICROPY_FLOAT_C_FUN(exp)(real);
@@ -89,7 +89,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_exp_obj, mp_cmath_exp);
 /// \function log(z)
 /// Return the natural logarithm of `z`.  The branch cut is along the negative real axis.
 // TODO can take second argument, being the base
-mp_obj_t mp_cmath_log(mp_obj_t z_obj) {
+STATIC mp_obj_t mp_cmath_log(mp_obj_t z_obj) {
     mp_float_t real, imag;
     mp_obj_get_complex(z_obj, &real, &imag);
     return mp_obj_new_complex(0.5 * MICROPY_FLOAT_C_FUN(log)(real*real + imag*imag), MICROPY_FLOAT_C_FUN(atan2)(imag, real));
@@ -98,7 +98,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_log_obj, mp_cmath_log);
 
 /// \function log10(z)
 /// Return the base-10 logarithm of `z`.  The branch cut is along the negative real axis.
-mp_obj_t mp_cmath_log10(mp_obj_t z_obj) {
+STATIC mp_obj_t mp_cmath_log10(mp_obj_t z_obj) {
     mp_float_t real, imag;
     mp_obj_get_complex(z_obj, &real, &imag);
     return mp_obj_new_complex(0.5 * MICROPY_FLOAT_C_FUN(log10)(real*real + imag*imag), MICROPY_FLOAT_C_FUN(atan2)(imag, real));
@@ -107,7 +107,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_log10_obj, mp_cmath_log10);
 
 /// \function sqrt(z)
 /// Return the square-root of `z`.
-mp_obj_t mp_cmath_sqrt(mp_obj_t z_obj) {
+STATIC mp_obj_t mp_cmath_sqrt(mp_obj_t z_obj) {
     mp_float_t real, imag;
     mp_obj_get_complex(z_obj, &real, &imag);
     mp_float_t sqrt_abs = MICROPY_FLOAT_C_FUN(pow)(real*real + imag*imag, 0.25);
@@ -118,7 +118,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_sqrt_obj, mp_cmath_sqrt);
 
 /// \function cos(z)
 /// Return the cosine of `z`.
-mp_obj_t mp_cmath_cos(mp_obj_t z_obj) {
+STATIC mp_obj_t mp_cmath_cos(mp_obj_t z_obj) {
     mp_float_t real, imag;
     mp_obj_get_complex(z_obj, &real, &imag);
     return mp_obj_new_complex(MICROPY_FLOAT_C_FUN(cos)(real) * MICROPY_FLOAT_C_FUN(cosh)(imag), -MICROPY_FLOAT_C_FUN(sin)(real) * MICROPY_FLOAT_C_FUN(sinh)(imag));
@@ -127,7 +127,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_cos_obj, mp_cmath_cos);
 
 /// \function sin(z)
 /// Return the sine of `z`.
-mp_obj_t mp_cmath_sin(mp_obj_t z_obj) {
+STATIC mp_obj_t mp_cmath_sin(mp_obj_t z_obj) {
     mp_float_t real, imag;
     mp_obj_get_complex(z_obj, &real, &imag);
     return mp_obj_new_complex(MICROPY_FLOAT_C_FUN(sin)(real) * MICROPY_FLOAT_C_FUN(cosh)(imag), MICROPY_FLOAT_C_FUN(cos)(real) * MICROPY_FLOAT_C_FUN(sinh)(imag));
diff --git a/py/modmath.c b/py/modmath.c
index 0111dc55232408e3c969f301283835b39b04f5af..b922f3e4906987ca2e3db59bcfd912bf4f142a05 100644
--- a/py/modmath.c
+++ b/py/modmath.c
@@ -41,19 +41,19 @@
 
 //TODO: Change macros to check for overflow and raise OverflowError or RangeError
 #define MATH_FUN_1(py_name, c_name) \
-    mp_obj_t mp_math_ ## py_name(mp_obj_t x_obj) { return mp_obj_new_float(MICROPY_FLOAT_C_FUN(c_name)(mp_obj_get_float(x_obj))); } \
+    STATIC mp_obj_t mp_math_ ## py_name(mp_obj_t x_obj) { return mp_obj_new_float(MICROPY_FLOAT_C_FUN(c_name)(mp_obj_get_float(x_obj))); } \
     STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_## py_name ## _obj, mp_math_ ## py_name);
 
 #define MATH_FUN_2(py_name, c_name) \
-    mp_obj_t mp_math_ ## py_name(mp_obj_t x_obj, mp_obj_t y_obj) { return mp_obj_new_float(MICROPY_FLOAT_C_FUN(c_name)(mp_obj_get_float(x_obj), mp_obj_get_float(y_obj))); } \
+    STATIC mp_obj_t mp_math_ ## py_name(mp_obj_t x_obj, mp_obj_t y_obj) { return mp_obj_new_float(MICROPY_FLOAT_C_FUN(c_name)(mp_obj_get_float(x_obj), mp_obj_get_float(y_obj))); } \
     STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_math_## py_name ## _obj, mp_math_ ## py_name);
 
 #define MATH_FUN_1_TO_BOOL(py_name, c_name) \
-    mp_obj_t mp_math_ ## py_name(mp_obj_t x_obj) { return MP_BOOL(c_name(mp_obj_get_float(x_obj))); } \
+    STATIC mp_obj_t mp_math_ ## py_name(mp_obj_t x_obj) { return MP_BOOL(c_name(mp_obj_get_float(x_obj))); } \
     STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_## py_name ## _obj, mp_math_ ## py_name);
 
 #define MATH_FUN_1_TO_INT(py_name, c_name) \
-    mp_obj_t mp_math_ ## py_name(mp_obj_t x_obj) { return mp_obj_new_int((mp_int_t)MICROPY_FLOAT_C_FUN(c_name)(mp_obj_get_float(x_obj))); } \
+    STATIC mp_obj_t mp_math_ ## py_name(mp_obj_t x_obj) { mp_int_t x = MICROPY_FLOAT_C_FUN(c_name)(mp_obj_get_float(x_obj)); return mp_obj_new_int(x); } \
     STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_## py_name ## _obj, mp_math_ ## py_name);
 
 // These are also used by cmath.c
@@ -142,7 +142,7 @@ MATH_FUN_1(lgamma, lgamma)
 
 /// \function frexp(x)
 /// Converts a floating-point number to fractional and integral components.
-mp_obj_t mp_math_frexp(mp_obj_t x_obj) {
+STATIC mp_obj_t mp_math_frexp(mp_obj_t x_obj) {
     int int_exponent = 0;
     mp_float_t significand = MICROPY_FLOAT_C_FUN(frexp)(mp_obj_get_float(x_obj), &int_exponent);
     mp_obj_t tuple[2];
@@ -153,7 +153,7 @@ mp_obj_t mp_math_frexp(mp_obj_t x_obj) {
 STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_frexp_obj, mp_math_frexp);
 
 /// \function modf(x)
-mp_obj_t mp_math_modf(mp_obj_t x_obj) {
+STATIC mp_obj_t mp_math_modf(mp_obj_t x_obj) {
     mp_float_t int_part = 0.0;
     mp_float_t fractional_part = MICROPY_FLOAT_C_FUN(modf)(mp_obj_get_float(x_obj), &int_part);
     mp_obj_t tuple[2];
@@ -166,13 +166,13 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_modf_obj, mp_math_modf);
 // Angular conversions
 
 /// \function radians(x)
-mp_obj_t mp_math_radians(mp_obj_t x_obj) {
+STATIC mp_obj_t mp_math_radians(mp_obj_t x_obj) {
     return mp_obj_new_float(mp_obj_get_float(x_obj) * M_PI / 180.0);
 }
 STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_radians_obj, mp_math_radians);
 
 /// \function degrees(x)
-mp_obj_t mp_math_degrees(mp_obj_t x_obj) {
+STATIC mp_obj_t mp_math_degrees(mp_obj_t x_obj) {
     return mp_obj_new_float(mp_obj_get_float(x_obj) * 180.0 / M_PI);
 }
 STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_degrees_obj, mp_math_degrees);
diff --git a/py/objboundmeth.c b/py/objboundmeth.c
index 609895032892273fb8b47f1287fe9ae580becdf8..66af5df0a947b9355a4c0684053eedf0612b2aea 100644
--- a/py/objboundmeth.c
+++ b/py/objboundmeth.c
@@ -50,7 +50,7 @@ STATIC void bound_meth_print(void (*print)(void *env, const char *fmt, ...), voi
 }
 #endif
 
-mp_obj_t bound_meth_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+STATIC mp_obj_t bound_meth_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
     mp_obj_bound_meth_t *self = self_in;
 
     // need to insert self->self before all other args and then call self->meth
diff --git a/py/objclosure.c b/py/objclosure.c
index 16133c127b9e476ada230dde939cacbf1a455371..d563206b629aab2f7f8a4e1704ce9de3a6e00a6d 100644
--- a/py/objclosure.c
+++ b/py/objclosure.c
@@ -41,7 +41,7 @@ typedef struct _mp_obj_closure_t {
     mp_obj_t closed[];
 } mp_obj_closure_t;
 
-mp_obj_t closure_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+STATIC mp_obj_t closure_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
     mp_obj_closure_t *self = self_in;
 
     // need to concatenate closed-over-vars and args
diff --git a/py/objdict.c b/py/objdict.c
index a624320427ce860f8fd7c56d209ddafdc35f8232..2f4ae7083059e1ac99dbacd2951932df939d9ef3 100644
--- a/py/objdict.c
+++ b/py/objdict.c
@@ -491,7 +491,7 @@ STATIC const mp_obj_type_t dict_view_type = {
     .getiter = dict_view_getiter,
 };
 
-mp_obj_t mp_obj_new_dict_view(mp_obj_dict_t *dict, mp_dict_view_kind_t kind) {
+STATIC mp_obj_t mp_obj_new_dict_view(mp_obj_dict_t *dict, mp_dict_view_kind_t kind) {
     mp_obj_dict_view_t *o = m_new_obj(mp_obj_dict_view_t);
     o->base.type = &dict_view_type;
     o->dict = dict;
diff --git a/py/objgenerator.c b/py/objgenerator.c
index ce26cbce26523f1dd3f5c69e5eaa398d50134880..646ae4fdd4c55b3641a6d5654aa5a3b234fe36f1 100644
--- a/py/objgenerator.c
+++ b/py/objgenerator.c
@@ -97,7 +97,7 @@ mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun) {
 /******************************************************************************/
 /* generator instance                                                         */
 
-void gen_instance_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
+STATIC void gen_instance_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
     mp_obj_gen_instance_t *self = self_in;
     print(env, "<generator object '%s' at %p>", mp_obj_code_get_name(self->code_state.code_info), self_in);
 }
@@ -183,7 +183,7 @@ STATIC mp_obj_t gen_resume_and_raise(mp_obj_t self_in, mp_obj_t send_value, mp_o
     }
 }
 
-mp_obj_t gen_instance_iternext(mp_obj_t self_in) {
+STATIC mp_obj_t gen_instance_iternext(mp_obj_t self_in) {
     return gen_resume_and_raise(self_in, mp_const_none, MP_OBJ_NULL);
 }
 
diff --git a/py/objlist.c b/py/objlist.c
index 1531b6be950df3a942192efdf2e5cb8670378f94..3e5355719e954f486776224171294f5b6218b4ff 100644
--- a/py/objlist.c
+++ b/py/objlist.c
@@ -497,7 +497,7 @@ typedef struct _mp_obj_list_it_t {
     mp_uint_t cur;
 } mp_obj_list_it_t;
 
-mp_obj_t list_it_iternext(mp_obj_t self_in) {
+STATIC mp_obj_t list_it_iternext(mp_obj_t self_in) {
     mp_obj_list_it_t *self = self_in;
     if (self->cur < self->list->len) {
         mp_obj_t o_out = self->list->items[self->cur];
diff --git a/py/objnamedtuple.c b/py/objnamedtuple.c
index 018c8bbebd78e044f91b96fefc844addf5475a15..f6c8f19c23f72f3d4c91b885bd54a89b8ce92223 100644
--- a/py/objnamedtuple.c
+++ b/py/objnamedtuple.c
@@ -150,7 +150,7 @@ STATIC mp_obj_t namedtuple_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_
 
 STATIC const mp_obj_tuple_t namedtuple_base_tuple = {{&mp_type_tuple}, 1, {(mp_obj_t)&mp_type_tuple}};
 
-mp_obj_t mp_obj_new_namedtuple_type(qstr name, const char *fields) {
+STATIC mp_obj_t mp_obj_new_namedtuple_type(qstr name, const char *fields) {
     mp_obj_namedtuple_type_t *o = m_new0(mp_obj_namedtuple_type_t, 1);
     o->base.base.type = &mp_type_type;
     o->base.name = name;
diff --git a/py/objslice.c b/py/objslice.c
index 6324c0e49bf97e2bbd90c9d1be03e43c4fc59c14..c99b9d08dbf4a2113aba3446262f8aed09f11c97 100644
--- a/py/objslice.c
+++ b/py/objslice.c
@@ -41,7 +41,7 @@ typedef struct _mp_obj_ellipsis_t {
     mp_obj_base_t base;
 } mp_obj_ellipsis_t;
 
-void ellipsis_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
+STATIC void ellipsis_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
     print(env, "Ellipsis");
 }
 
@@ -67,7 +67,7 @@ typedef struct _mp_obj_slice_t {
     mp_obj_t step;
 } mp_obj_slice_t;
 
-void slice_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
+STATIC void slice_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
     mp_obj_slice_t *o = o_in;
     print(env, "slice(");
     mp_obj_print_helper(print, env, o->start, PRINT_REPR);
diff --git a/py/objstringio.c b/py/objstringio.c
index d3673d1f96398c83cd4a83015ea7cdb7bd03d28a..e5abc0526f3022231a4c8563a97173a4373ce9b0 100644
--- a/py/objstringio.c
+++ b/py/objstringio.c
@@ -95,7 +95,7 @@ STATIC mp_obj_t stringio_close(mp_obj_t self_in) {
 }
 STATIC MP_DEFINE_CONST_FUN_OBJ_1(stringio_close_obj, stringio_close);
 
-mp_obj_t stringio___exit__(mp_uint_t n_args, const mp_obj_t *args) {
+STATIC mp_obj_t stringio___exit__(mp_uint_t n_args, const mp_obj_t *args) {
     return stringio_close(args[0]);
 }
 STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stringio___exit___obj, 4, 4, stringio___exit__);
diff --git a/py/pfenv_printf.c b/py/pfenv_printf.c
index c0e826a5d2bbce6fb9182b97a30e2148869da54b..9e65fea9d377e040bad442ff3086c05f0bc8f4ac 100644
--- a/py/pfenv_printf.c
+++ b/py/pfenv_printf.c
@@ -40,7 +40,7 @@
 #include "formatfloat.h"
 #endif
 
-int pfenv_vprintf(const pfenv_t *pfenv, const char *fmt, va_list args) {
+STATIC int pfenv_vprintf(const pfenv_t *pfenv, const char *fmt, va_list args) {
     int chrs = 0;
     for (;;) {
         {
diff --git a/py/repl.c b/py/repl.c
index 66a67e3d5b65b780b6248694cc25e7a98da73995..6bd880d92a2d2aa03a519154940dbae9c96f49ac 100644
--- a/py/repl.c
+++ b/py/repl.c
@@ -30,7 +30,7 @@
 
 #if MICROPY_HELPER_REPL
 
-bool str_startswith_word(const char *str, const char *head) {
+STATIC bool str_startswith_word(const char *str, const char *head) {
     mp_uint_t i;
     for (i = 0; str[i] && head[i]; i++) {
         if (str[i] != head[i]) {
diff --git a/py/vstr.c b/py/vstr.c
index c23bbaa0052cbb5c563682242f825fdfad19d5dd..03b03d0a30096c668c3be1d73537e21c7d3a196e 100644
--- a/py/vstr.c
+++ b/py/vstr.c
@@ -263,7 +263,7 @@ copy:
     vstr->buf[vstr->len] = 0;
 }
 
-char *vstr_ins_blank_bytes(vstr_t *vstr, size_t byte_pos, size_t byte_len) {
+STATIC char *vstr_ins_blank_bytes(vstr_t *vstr, size_t byte_pos, size_t byte_len) {
     if (vstr->had_error) {
         return NULL;
     }
diff --git a/unix/file.c b/unix/file.c
index 4a11d24bde29ee1d1b8858cd0eea5b09c2eb2398..02b8aff186a09e520a5d6a989fdf0bff536dd2d9 100644
--- a/unix/file.c
+++ b/unix/file.c
@@ -49,7 +49,7 @@ typedef struct _mp_obj_fdfile_t {
 } mp_obj_fdfile_t;
 
 #ifdef MICROPY_CPYTHON_COMPAT
-void check_fd_is_open(const mp_obj_fdfile_t *o) {
+STATIC void check_fd_is_open(const mp_obj_fdfile_t *o) {
     if (o->fd < 0) {
         nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "I/O operation on closed file"));
     }
@@ -123,7 +123,7 @@ STATIC mp_obj_t fdfile_close(mp_obj_t self_in) {
 }
 STATIC MP_DEFINE_CONST_FUN_OBJ_1(fdfile_close_obj, fdfile_close);
 
-mp_obj_t fdfile___exit__(mp_uint_t n_args, const mp_obj_t *args) {
+STATIC mp_obj_t fdfile___exit__(mp_uint_t n_args, const mp_obj_t *args) {
     return fdfile_close(args[0]);
 }
 STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(fdfile___exit___obj, 4, 4, fdfile___exit__);
diff --git a/unix/gccollect.c b/unix/gccollect.c
index 117c13144f92ae8fbad9c91b99fee79c09768bc7..2c7b81918a44788bcb5387f7b3d9b3628fe3f7f6 100644
--- a/unix/gccollect.c
+++ b/unix/gccollect.c
@@ -40,7 +40,7 @@ extern char *stack_top;
 
 typedef jmp_buf regs_t;
 
-void gc_helper_get_regs(regs_t arr) {
+STATIC void gc_helper_get_regs(regs_t arr) {
     setjmp(arr);
 }
 
@@ -86,7 +86,7 @@ void gc_helper_get_regs(regs_t arr) {
 #ifdef __i386__
 typedef mp_uint_t regs_t[4];
 
-void gc_helper_get_regs(regs_t arr) {
+STATIC void gc_helper_get_regs(regs_t arr) {
     register long ebx asm ("ebx");
     register long esi asm ("esi");
     register long edi asm ("edi");
@@ -101,7 +101,7 @@ void gc_helper_get_regs(regs_t arr) {
 #if defined(__thumb2__) || defined(__thumb__) || defined(__arm__)
 typedef mp_uint_t regs_t[10];
 
-void gc_helper_get_regs(regs_t arr) {
+STATIC void gc_helper_get_regs(regs_t arr) {
     register long r4 asm ("r4");
     register long r5 asm ("r5");
     register long r6 asm ("r6");
diff --git a/unix/main.c b/unix/main.c
index 2a0dc864c4f52390f217cc482f3e6f7b642c7b9d..8a564dbfa5bd0c9b430093c65d0796466bbbe882 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -239,7 +239,7 @@ STATIC int do_str(const char *str) {
     return execute_from_lexer(lex, MP_PARSE_FILE_INPUT, false);
 }
 
-int usage(char **argv) {
+STATIC int usage(char **argv) {
     printf(
 "usage: %s [<opts>] [-X <implopt>] [-c <command>] [<filename>]\n"
 "Options:\n"
@@ -269,7 +269,7 @@ int usage(char **argv) {
 }
 
 // Process options which set interpreter init options
-void pre_process_options(int argc, char **argv) {
+STATIC void pre_process_options(int argc, char **argv) {
     for (int a = 1; a < argc; a++) {
         if (argv[a][0] == '-') {
             if (strcmp(argv[a], "-X") == 0) {
@@ -318,7 +318,7 @@ void pre_process_options(int argc, char **argv) {
     }
 }
 
-void set_sys_argv(char *argv[], int argc, int start_arg) {
+STATIC void set_sys_argv(char *argv[], int argc, int start_arg) {
     for (int i = start_arg; i < argc; i++) {
         mp_obj_list_append(mp_sys_argv, MP_OBJ_NEW_QSTR(qstr_from_str(argv[i])));
     }
diff --git a/unix/modffi.c b/unix/modffi.c
index 6f877892906ea2685e8639537d2ea8b59ddd9d7c..b268bb364f3d155c88676ea0f504697e2c3af8c4 100644
--- a/unix/modffi.c
+++ b/unix/modffi.c
@@ -300,7 +300,7 @@ STATIC void ffifunc_print(void (*print)(void *env, const char *fmt, ...), void *
     print(env, "<ffifunc %p>", self->func);
 }
 
-mp_obj_t ffifunc_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+STATIC mp_obj_t ffifunc_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
     mp_obj_ffifunc_t *self = self_in;
     assert(n_kw == 0);
     assert(n_args == self->cif.nargs);
@@ -416,12 +416,12 @@ STATIC const mp_obj_type_t opaque_type = {
 };
 */
 
-mp_obj_t mod_ffi_open(mp_uint_t n_args, const mp_obj_t *args) {
+STATIC mp_obj_t mod_ffi_open(mp_uint_t n_args, const mp_obj_t *args) {
     return ffimod_make_new((mp_obj_t)&ffimod_type, n_args, 0, args);
 }
 MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_ffi_open_obj, 1, 2, mod_ffi_open);
 
-mp_obj_t mod_ffi_as_bytearray(mp_obj_t ptr, mp_obj_t size) {
+STATIC mp_obj_t mod_ffi_as_bytearray(mp_obj_t ptr, mp_obj_t size) {
     return mp_obj_new_bytearray_by_ref(mp_obj_int_get_truncated(size), (void*)mp_obj_int_get_truncated(ptr));
 }
 MP_DEFINE_CONST_FUN_OBJ_2(mod_ffi_as_bytearray_obj, mod_ffi_as_bytearray);