Skip to content
Snippets Groups Projects

fix(epicardium): use less collision-prone names for stub-local variables

Merged swym requested to merge swym/firmware:stubvars into master
1 file
+ 10
10
Compare changes
  • Side-by-side
  • Inline
+ 10
10
@@ -150,18 +150,18 @@ def main():
/* Autogenerated stub for {id} */
{return_type} {name}({args_str})
{{
const int size = {total_size};
void*buffer;
const int epc__apistub_size = {total_size};
void*epc__apistub_buffer;
buffer = _api_call_start({id}, size);
/* TODO: Check if buffer is not NULL */
epc__apistub_buffer = _api_call_start({id}, epc__apistub_size);
/* TODO: Check if epc__apistub_buffer is not NULL */
"""
f_client.write(tmp.format(**decl))
for i, arg in enumerate(decl["args"]):
tmp = """\
*({type}*)(buffer + {offset}) = {name};
*({type}*)(epc__apistub_buffer + {offset}) = {name};
"""
f_client.write(tmp.format(**arg))
@@ -169,14 +169,14 @@ def main():
# Don't return if return type is void
tmp = """\
_api_call_transact(buffer);
_api_call_transact(epc__apistub_buffer);
}}
"""
f_client.write(tmp.format(**decl))
else:
tmp = """\
return *({return_type}*)_api_call_transact(buffer);
return *({return_type}*)_api_call_transact(epc__apistub_buffer);
}}
"""
f_client.write(tmp.format(**decl))
@@ -249,7 +249,7 @@ void __dispatch_isr(api_int_id_t id)
#include "modules/log.h"
#include "{header}"
void __api_dispatch_call(uint32_t id, void*buffer)
void __api_dispatch_call(uint32_t id, void*epc__apistub_buffer)
{{
switch (id) {{
"""
@@ -264,13 +264,13 @@ void __api_dispatch_call(uint32_t id, void*buffer)
else:
tmp = """\
case {id}:
*(({return_type}*)buffer) = {name}("""
*(({return_type}*)epc__apistub_buffer) = {name}("""
f_dispatcher.write(tmp.format(**decl))
for i, arg in enumerate(decl["args"]):
arg["comma"] = "" if i == 0 else ","
tmp = """{comma}
*({type}*)(buffer + {offset})"""
*({type}*)(epc__apistub_buffer + {offset})"""
f_dispatcher.write(tmp.format(**arg))
tmp = """
Loading