[Tf-m] Replace custom code generating scripts with Jinja2