Skip to content

Commit

Permalink
fix(array_axis_vcs): add stubs.c
Browse files Browse the repository at this point in the history
  • Loading branch information
umarcor committed Apr 8, 2019
1 parent 9192169 commit 1d079c2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/vhdl/array_axis_vcs/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@

# vu.set_sim_option('modelsim.init_files.after_load',['runall_addwave.do'])

c_nobj = join(root, 'src/test/stubs.o')
print(os.popen('gcc -fPIC -rdynamic -c '+join(root, 'src/**/stubs.c')+' -o '+c_nobj).read())

vu.set_sim_option("ghdl.elab_flags", ["-Wl,"+c_nobj])

c_obj = join(root, 'src/test/main.o')
# This can be executed externally, should C sources be more complex than a single file.
print(os.popen('gcc -fPIC -rdynamic -c '+join(root, 'src/**/*.c')+' -o '+c_obj).read())
Expand Down
17 changes: 17 additions & 0 deletions examples/vhdl/array_axis_vcs/src/test/stubs.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

// get_param is used by GHDL to retrieve parameter values (integers).
uint32_t get_param(uint32_t w) {
printf("ERROR get_param: THIS IS A STUB\n");
exit(1);
return 0;
}

// get_param is used by GHDL to retrieve pointers to the base addresses of the buffers.
uintptr_t get_addr(uint32_t w) {
printf("ERROR get_addr: THIS IS A STUB\n");
exit(1);
return (uintptr_t)NULL;
}

0 comments on commit 1d079c2

Please sign in to comment.