Hi Everyone,
I have main application in C and I need to integrate few tools into Bazel using Python.
I have written the STLink CLI deploy mechanism in Python and passing the executable(.hex) of C program as input to Python program to deploy to microcontroller board.
For now
"Bazel Build --platform=... //application" is creating a hex file and working perfectly.
Now i need to implement RUN command that builds the executable and also deploy that executable using STlink python Program.
"Bazel RUN target --platform=... //application"
Here is snippet:
Main C application/ Build:
cc_binary(
name = "app",
srcs = glob(["*.c"]),
deps = [
....
],
visibility = ["//visibility:public"],
)
Python Program: //Tools/stlink/Build
py_binary(
name = "run",
srcs = glob(["*.py"]),
main = "main.py",
)
Tool implementation is present in Main.py.
try:
programming_output = subprocess.check_output(
[
'ST-LINK_CLI.exe',
'-c',
'SN=' + str(probe),
'SWD',
'UR',
'Hrst',
'-Q',
'-P',
hex_file_path,
'-V',
'-HardRST',
'HIGH',
'-Rst',
],
..................................................................
if __name__ == '__main__':
status, checksum = flash('.hex file path')
print(status)
Problem:
I'm unable to get the RUN command to work. I need to know how can I integrate the python program into the Bazel to get the RUN Command to work. Any guidance would be of great help.
Thank you in advance.
Uma