Command line arguments for a target

Hello,
is it possible to append a custom argument to a target?

I would like to do following

pio -t inject 0x05 (here I would like to inject some unique id into firmware file, in this case 0x05)

and then doing following in a script

def injection_callback(*args, **kwargs):
    device_id=args[3]
    #do id injection

env.AddCustomTarget( 
    name = "inject", 
    dependencies="$BUILD_DIR/${PROGNAME}.srec", 
    actions=injection_callback,
)

how to do this?
I know that native mode has this feature because you would like to pass arguments to a RUNNING application. In my case the app is not running, but the firmware or whatever else being changed at target invocation time.

Thank you!

1 Like