-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
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
release debug pins on HC32 boards #26985
release debug pins on HC32 boards #26985
Conversation
Marlin/src/HAL/HC32/HAL.h
Outdated
#define JTAGSWD_RESET() PORT_DebugPortSetting(0x1F, Enable); // enable JTDO, JTDI, NJTRST, SWDIO, SWCLK | ||
#define JTAG_DISABLE() PORT_DebugPortSetting(0x1C, Disable); // disable JTDO, JTDI, NJTRST | ||
#define JTAGSWD_DISABLE() PORT_DebugPortSetting(0x1F, Disable); // disable JTDO, JTDI, NJTRST, SWDIO, SWCLK |
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.
What do you think of using the named variables here for the pins?
#define JTAGSWD_RESET() PORT_DebugPortSetting(0x1F, Enable); // enable JTDO, JTDI, NJTRST, SWDIO, SWCLK | |
#define JTAG_DISABLE() PORT_DebugPortSetting(0x1C, Disable); // disable JTDO, JTDI, NJTRST | |
#define JTAGSWD_DISABLE() PORT_DebugPortSetting(0x1F, Disable); // disable JTDO, JTDI, NJTRST, SWDIO, SWCLK | |
#define JTAGSWD_RESET() PORT_DebugPortSetting(ALL_DBG_PIN, Enable); | |
#define JTAG_DISABLE() PORT_DebugPortSetting(TDO_SWO | TDI | TRST, Disable); | |
#define JTAGSWD_DISABLE() PORT_DebugPortSetting(ALL_DBG_PIN, Disable); |
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.
looks a lot more readable than using "magic" values. I'll update the PR accordingly
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.
Sorry for the delay, I had seen your comment but didn't realize the change has been made.
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.
The bit names I used in my recommendation were actually from the HC32 headers, I don't think you had to redefine them.
That said, your bit names are a little more consistent than those, so I think it is fine to go ahead and use what you've done in your most recent change.
implements DISABLE_DEBUG and DISABLE_JTAG in HAL
bc7dfe6
to
87636d4
Compare
implements DISABLE_DEBUG and DISABLE_JTAG in HAL
Description
On
someall currently supported HC32 boards, pins normally assigned to debugging functions are re-used for other functions.The PR implements
DISABLE_DEBUG
andDISABLE_JTAG
in the HC32 HAL and adds the corrosponding defined to the HC32 board files.Currently, this doesn't cause issues since the bootloader releases these pins before booting into Marlin.
However, it's probably best to not rely on a side-effect of the bootloader, in case it changes with newer board revisions (or the user changes it).
Requirements
HC32-Based Board
Benefits
Removes reliance on side-effect of the bootloader
Configurations
N/A
Related Issues
N/A
Appendix
PSPCR
register overview (set byPORT_DebugPortSetting
)Debug Port Pins assignments according to HC32F460 Datasheet