You may define some flags to be passed to tasks at compile time.
They will be:
- added to compile line as
-DKEY=value
on every source file for a given task - passed to coprocessor creation as optional arguments
Usage examples
tg = TaskModel( 'tg', outfifos = ['output'], impl = [ SwTask( 'tg', stack_size = 4096, sources = [ 'src/tg_posix.c' ], defines = ['FILE_NAME', 'NB_ITER'] ) ] ) tg_inst = Task( tg, 'tg_inst_0', portmap = { 'output':fifo_to_app }, defines = { 'FILE_NAME':'"plan.jpeg"', 'NB_ITER':'4' } )
Yes, have double quotes for strings so that the name is still a string when it comes to C...
Warning
Defined values when compiling a C file are unpredictable if
- This C file is shared between tasks
- The task corresponding to the C-file is instanciated more than once with different defines
If the only purpose is to pass up a numeric value, you should use consts
.
Last modified 18 years ago
Last modified on Sep 7, 2006, 10:18:01 PM