-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[refactoring] General maintenance #1212
Comments
@Ant-ON @slyshykO I have just pushed a new commit to branch |
Based on the original intention to solely complete the separation of chip-specific parametres out of the source code and into device-specific files led to some more general clean-up and restructuring. Nevertheless work is not complete of course... For now I am going to make a halt here to give everybody a chance to follow the changes which appear quite huge already. |
... and BTW: When does
exactly make sense? |
It needs for whom who uses our includes in C++ code. |
Tell me a story, I got that far, but the question is: Where is it necessary from the technical perspective. It is not in general, because otherwise it would be defined in every source code file, which isn't the case and compilation and execution in C++ is known to be working anyway. |
What is "modularisation of common.c"? Divide it to several files? |
It is necessary when someone uses libstlink in a custom C++ application because C++ mangle functions names by default and without Also, this extern guard is not needed in all sources. It is required only in the main header, for example, in stlink.h in our case. |
@hydroconstructor |
Please test the branch |
🔶 As discussed with @Nightwalker-87, I’m adding another cleanup-related idea, originally described at c854df5#commitcomment-63941871.
I suggest the following:
|
@gszy I've replaced the list of defines with an enum holding the flash types in human readable form and added the individual types to the .chip files, replacing the integer values there. However this implies that the following excerpt in
I'm unsure yet on the most reasonable approach. So far this unfinished attempt is only a local version for testing purposes. |
The simplest solution would be a bunch of this kind of comparisons: if (strcmp(value, "G0") == 0) {
&ts->flash_type = STM32_FLASH_TYPE_G0;
} It may be a part of Alternatively we could have a const array somewhere that would map the enum values to the string values, something like: const char *x[] = {
[STM32_FLASH_TYPE_G0] = "G0",
}; then loop through the array when parsing a flash type. |
The following tasks should be achieved to improve the codebase of the toolset:
chipid.c
chipid.h
common.c
stlink.h
stm32.h
Some intentions on general proceedings (priorised):
stlink-lib
documentationThe text was updated successfully, but these errors were encountered: