-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
[RFC]Template prototype with updated edts #10873
Changes from 1 commit
f4110cd
71840bc
5f61191
754097a
274ba16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{% import 'i2c_ll_stm32.meta.jinja2' as i2c_stm32 %} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I probably misunderstood you, but I though you wanted me to have the .h so that the IDE's would recognize it as .h file, but that was maybe for when I rendered the whole driver file and not this file that is included in the driver file? |
||
|
||
#ifndef _I2C_LL_STM32_DEVICE_H_ | ||
#define _I2C_LL_STM32_DEVICE_H_ | ||
|
||
{{ i2c_stm32.device(data, ['st,stm32-i2c-v1', 'st,stm32-i2c-v2']) }} | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ zephyr_library() | |
|
||
zephyr_library_sources_ifdef(CONFIG_SPI_DW spi_dw.c) | ||
zephyr_library_sources_ifdef(CONFIG_SPI_INTEL spi_intel.c) | ||
zephyr_library_sources_codegen_ifdef(CONFIG_SPI_STM32 spi_ll_stm32.c.jinja2 SEARCH_PATH ${PROJECT_SOURCE_DIR}"/templates/") | ||
zephyr_library_sources_codegen_ifdef(CONFIG_SPI_STM32 spi_ll_stm32_device_template.h CODEGEN_OUTPUT spi_ll_stm32_device.h SEARCH_PATH ${PROJECT_SOURCE_DIR}"/templates/") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you provide a more easy to use macro? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well, you can omit CODEGEN_OUTPUT and SEARCH_PATH if you don't need them CODEGEN_OUTPUT is to control the name of the rendered file which can be nice in many cases SEARCH_PATH is set "include_paths", so if you have templates in other folders that you want to reuse in your template (with the include/import or extends keywords) |
||
zephyr_library_sources_ifdef(CONFIG_SPI_MCUX_DSPI spi_mcux_dspi.c) | ||
zephyr_library_sources_ifdef(CONFIG_SPI_MCUX_LPSPI spi_mcux_lpspi.c) | ||
zephyr_library_sources_ifdef(CONFIG_SPI_SAM spi_sam.c) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
{% import 'spi_ll_stm32.meta.jinja2' as spi_stm32 %} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you still need to have jinja2 extension on this file? |
||
|
||
/* | ||
* Copyright (c) 2016 BayLibre, SAS | ||
* Copyright (c) 2018 Nordic Semiconductor ASA | ||
|
@@ -480,4 +478,5 @@ static int spi_stm32_init(struct device *dev) | |
return 0; | ||
} | ||
|
||
{{ spi_stm32.device(data, ['st,stm32-spi', 'st,stm32-spi-fifo']) }} | ||
#include "spi_ll_stm32_device.h" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think i2c_ll_stm32_devices.h would make more sense.
Then, should we include .c or .h file?
I'm not sure to have any preference, but question should be asked.
@carlescufi ? @galak ?
Any preference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I go back and forth about this, but maybe .c, and adding a comment about so something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of don't like either and would prefer to render the content directly into the driver file instead.
Like I did here https://github.com/evenl/zephyr/blob/843cfad25ea6c1c6347b77365f8e4d5e171c868d/drivers/spi/spi_ll_stm32.c.jinja2
But I know that I am probably in minority here ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@evenl
After thinking about this and discussing it with people, I really dislike the templated C file. I would like my
.c
file to be a.c
file, clean of templating and containing only.c
code.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I am anyway generating .h file as you requested in the first place.