Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flash_algo.py problem #58

Open
pashka32 opened this issue Jun 14, 2021 · 1 comment
Open

flash_algo.py problem #58

pashka32 opened this issue Jun 14, 2021 · 1 comment

Comments

@pashka32
Copy link

Hello. I am trying to run a flash_algo.py file.
I need to create an algo file for stm32h7. However, I am getting the error.
What could be the reason for this?

(venv) root@Note:/mnt/d/pyTest# python3 flash_algo.py STM32H7xx.FLM c_blob.tmpl out.c
Traceback (most recent call last):
  File "flash_algo.py", line 349, in <module>
    main()
  File "flash_algo.py", line 45, in main
    algo.process_template(args.template, args.output)
  File "flash_algo.py", line 158, in process_template
    target_text = template.render(data_dict)
  File "/mnt/d/pyTest/venv/lib/python3.8/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/mnt/d/pyTest/venv/lib/python3.8/site-packages/jinja2/environment.py", line 925, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 41, in top-level template code
jinja2.exceptions.UndefinedError: 'header_size' is undefined
@flit
Copy link
Member

flit commented Jun 19, 2021

This is caused by running flash_algo.py directly instead of running generate_blobs.py. (Sorry it's not very obvious!)

You can see here that generate_blobs.py defines the dictionary used for the Jinja template, including header_size:

data_dict = {
'name': os.path.splitext(os.path.split(args.elf_path)[-1])[0],
'prog_header': BLOB_HEADER,
'header_size': HEADER_SIZE,
'entry': args.blob_start,
'stack_pointer': SP,
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants