2017-08-10 12:36 AM
As title says, this a request to move generated functions SystemClock_Config and LL_Init (when LL is used) from main.c to peripheral file, if 'Generate peripheral initialization as a pair of '.c/.h' files per peripheral' is checked.
Reasoning behind this is to improve visibility in main.c.
2017-08-10 02:09 AM
Hi
Pikoulis.George
,In fact, I don't think that those two functions have a big impact on the 'main.c' file's visibility. However, I will share your suggestion internally for further check and analysis.
Khouloud.
2017-08-10 04:17 AM
Hello
,I just created an LL project where main.c is 265 lines long. The init functions I mentioned take up 97 lines.
Thank you for sharing my suggestion.
Best regards,
George
________________ Attachments : main.c.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyVU&d=%2Fa%2F0X0000000b91%2FFu_t9_Enmz8LQCWQ7vhDco26.3lw9Dcc5F0RADrl1Wc&asPdf=false2017-08-10 12:32 PM
I completely agree. I brought this up a long time ago (
https://community.st.com/0D50X00009XkhjJSAR
).I find that the HAL environment really wants to rule my project by taking main.c, main(), the Src directory and so on.
I'm using an RTOS where my code starts in a function called Init. main() isn't something that I should be dicking with. So I end up munging main.c and call main() something like HALSetup(), get rid of the main loop, since my program is made up of 15 tasks, each with their own infinite loop, and my init code calls HALSetup instead.
This works adequately, until I change a parameter in Cube (sorry CubeMX) and regenerate the code. Suddenly it matters what the files are called, where they live, and if I managed to keep my code within the regions that get overwritten.
Maybe there could be a switch in Cube that puts ST's code into a form that can be called rather than actually being main().
Andrei