-
Notifications
You must be signed in to change notification settings - Fork 3k
LPC81X: reduce code size and add ARM_GCC support #1299
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
Conversation
LPC810 has only 4KB of flash, thus avoiding dead code is really nice. Here the NVIC interrupt setup was pulled from the us_ticker code even if no code is using timer events. This also adds ARM_GCC support for TARGET_LPC81X. LPC81X and LPC82X support Cortex M0+ VTOR register, so it is not necessary to put non-init text at 0x200.
FYI my mbed account (I signed cla): users/cyprien |
else if (pin == P0_5) | ||
enable = 1 << 6; | ||
LPC_SWM->PINENABLE0 |= enable; | ||
} |
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.
Can you please provide details for this addition?
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 LPC81X family does not have a conventional list of functions per pin, but instead each pin can received any of the "movable" functions. The only exceptions are known as "fixed-pin functions" and are nEnabled using the PINENABLE0 register (1 == disabled). On boot 3 of these fixed functions are enabled:
- SWDIO_EN is set on P0_2
- SWCLK_EN is set on P0_3
- RESET_EN is set on P0_5
If you want to use one of those pins as GPIO, you must first disable the fixed-pin function, and they'll return to their default GPIO function.
However you usually don't want to disable the RESET or the SW functions, but on a LPC810 package that has only 8 pins, this is more than appreciable.
Does it look ok? |
@0xc0170 Hi, is there anything missing? Do you want more comments in the code? |
LGTM |
LPC81X: reduce code size and add ARM_GCC support
Fix the following warnings: -[Warning] USBTester.cpp@45,0: ARMmbed#1299-D: members and base-classes will be initialized in declaration order, not in member initialisation list order -[Warning] USBTester.h@41,0: ARMmbed#1300-D: ~USBTester inherits implicit virtual -[Warning] USBAudio.cpp@345,0: ARMmbed#1035-D: single-precision operand implicitly converted to double-precision -[Warning] USBHID.cpp@29,0: ARMmbed#1300-D: ~AsyncSend inherits implicit virtual -[Warning] USBHID.cpp@61,0: ARMmbed#1300-D: ~AsyncRead inherits implicit virtual -[Warning] USBHID.cpp@93,0: ARMmbed#1300-D: ~AsyncWait inherits implicit virtual -[Warning] EndpointResolver.cpp@125,26: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
Fix the following warnings: -[Warning] USBTester.cpp@45,0: #1299-D: members and base-classes will be initialized in declaration order, not in member initialisation list order -[Warning] USBTester.h@41,0: #1300-D: ~USBTester inherits implicit virtual -[Warning] USBAudio.cpp@345,0: #1035-D: single-precision operand implicitly converted to double-precision -[Warning] USBHID.cpp@29,0: #1300-D: ~AsyncSend inherits implicit virtual -[Warning] USBHID.cpp@61,0: #1300-D: ~AsyncRead inherits implicit virtual -[Warning] USBHID.cpp@93,0: #1300-D: ~AsyncWait inherits implicit virtual -[Warning] EndpointResolver.cpp@125,26: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
Fix the following warnings: -[Warning] USBTester.cpp@45,0: #1299-D: members and base-classes will be initialized in declaration order, not in member initialisation list order -[Warning] USBTester.h@41,0: #1300-D: ~USBTester inherits implicit virtual -[Warning] USBAudio.cpp@345,0: #1035-D: single-precision operand implicitly converted to double-precision -[Warning] USBHID.cpp@29,0: #1300-D: ~AsyncSend inherits implicit virtual -[Warning] USBHID.cpp@61,0: #1300-D: ~AsyncRead inherits implicit virtual -[Warning] USBHID.cpp@93,0: #1300-D: ~AsyncWait inherits implicit virtual -[Warning] EndpointResolver.cpp@125,26: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
Fix the following warnings: -[Warning] USBTester.cpp@45,0: #1299-D: members and base-classes will be initialized in declaration order, not in member initialisation list order -[Warning] USBTester.h@41,0: #1300-D: ~USBTester inherits implicit virtual -[Warning] USBAudio.cpp@345,0: #1035-D: single-precision operand implicitly converted to double-precision -[Warning] USBHID.cpp@29,0: #1300-D: ~AsyncSend inherits implicit virtual -[Warning] USBHID.cpp@61,0: #1300-D: ~AsyncRead inherits implicit virtual -[Warning] USBHID.cpp@93,0: #1300-D: ~AsyncWait inherits implicit virtual -[Warning] EndpointResolver.cpp@125,26: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
Fix the following warnings: -[Warning] USBTester.cpp@45,0: ARMmbed#1299-D: members and base-classes will be initialized in declaration order, not in member initialisation list order -[Warning] USBTester.h@41,0: ARMmbed#1300-D: ~USBTester inherits implicit virtual -[Warning] USBAudio.cpp@345,0: ARMmbed#1035-D: single-precision operand implicitly converted to double-precision -[Warning] USBHID.cpp@29,0: ARMmbed#1300-D: ~AsyncSend inherits implicit virtual -[Warning] USBHID.cpp@61,0: ARMmbed#1300-D: ~AsyncRead inherits implicit virtual -[Warning] USBHID.cpp@93,0: ARMmbed#1300-D: ~AsyncWait inherits implicit virtual -[Warning] EndpointResolver.cpp@125,26: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
Fix the following warnings: -[Warning] USBTester.cpp@45,0: #1299-D: members and base-classes will be initialized in declaration order, not in member initialisation list order -[Warning] USBTester.h@41,0: #1300-D: ~USBTester inherits implicit virtual -[Warning] USBAudio.cpp@345,0: #1035-D: single-precision operand implicitly converted to double-precision -[Warning] USBHID.cpp@29,0: #1300-D: ~AsyncSend inherits implicit virtual -[Warning] USBHID.cpp@61,0: #1300-D: ~AsyncRead inherits implicit virtual -[Warning] USBHID.cpp@93,0: #1300-D: ~AsyncWait inherits implicit virtual -[Warning] EndpointResolver.cpp@125,26: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
Fix the following warnings: -[Warning] USBTester.cpp@45,0: #1299-D: members and base-classes will be initialized in declaration order, not in member initialisation list order -[Warning] USBTester.h@41,0: #1300-D: ~USBTester inherits implicit virtual -[Warning] USBAudio.cpp@345,0: #1035-D: single-precision operand implicitly converted to double-precision -[Warning] USBHID.cpp@29,0: #1300-D: ~AsyncSend inherits implicit virtual -[Warning] USBHID.cpp@61,0: #1300-D: ~AsyncRead inherits implicit virtual -[Warning] USBHID.cpp@93,0: #1300-D: ~AsyncWait inherits implicit virtual -[Warning] EndpointResolver.cpp@125,26: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
Fix the following warnings: -[Warning] USBTester.cpp@45,0: #1299-D: members and base-classes will be initialized in declaration order, not in member initialisation list order -[Warning] USBTester.h@41,0: #1300-D: ~USBTester inherits implicit virtual -[Warning] USBAudio.cpp@345,0: #1035-D: single-precision operand implicitly converted to double-precision -[Warning] USBHID.cpp@29,0: #1300-D: ~AsyncSend inherits implicit virtual -[Warning] USBHID.cpp@61,0: #1300-D: ~AsyncRead inherits implicit virtual -[Warning] USBHID.cpp@93,0: #1300-D: ~AsyncWait inherits implicit virtual -[Warning] EndpointResolver.cpp@125,26: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
Fix the following warnings: -[Warning] USBTester.cpp@45,0: ARMmbed#1299-D: members and base-classes will be initialized in declaration order, not in member initialisation list order -[Warning] USBTester.h@41,0: ARMmbed#1300-D: ~USBTester inherits implicit virtual -[Warning] USBAudio.cpp@345,0: ARMmbed#1035-D: single-precision operand implicitly converted to double-precision -[Warning] USBHID.cpp@29,0: ARMmbed#1300-D: ~AsyncSend inherits implicit virtual -[Warning] USBHID.cpp@61,0: ARMmbed#1300-D: ~AsyncRead inherits implicit virtual -[Warning] USBHID.cpp@93,0: ARMmbed#1300-D: ~AsyncWait inherits implicit virtual -[Warning] EndpointResolver.cpp@125,26: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
Fix the following warnings: -[Warning] USBTester.cpp@45,0: #1299-D: members and base-classes will be initialized in declaration order, not in member initialisation list order -[Warning] USBTester.h@41,0: #1300-D: ~USBTester inherits implicit virtual -[Warning] USBAudio.cpp@345,0: #1035-D: single-precision operand implicitly converted to double-precision -[Warning] USBHID.cpp@29,0: #1300-D: ~AsyncSend inherits implicit virtual -[Warning] USBHID.cpp@61,0: #1300-D: ~AsyncRead inherits implicit virtual -[Warning] USBHID.cpp@93,0: #1300-D: ~AsyncWait inherits implicit virtual -[Warning] EndpointResolver.cpp@125,26: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
Fix the following warnings: -[Warning] USBTester.cpp@45,0: ARMmbed#1299-D: members and base-classes will be initialized in declaration order, not in member initialisation list order -[Warning] USBTester.h@41,0: ARMmbed#1300-D: ~USBTester inherits implicit virtual -[Warning] USBAudio.cpp@345,0: ARMmbed#1035-D: single-precision operand implicitly converted to double-precision -[Warning] USBHID.cpp@29,0: ARMmbed#1300-D: ~AsyncSend inherits implicit virtual -[Warning] USBHID.cpp@61,0: ARMmbed#1300-D: ~AsyncRead inherits implicit virtual -[Warning] USBHID.cpp@93,0: ARMmbed#1300-D: ~AsyncWait inherits implicit virtual -[Warning] EndpointResolver.cpp@125,26: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
LPC810 has only 4KB of flash, thus avoiding dead code is really nice.
Here the NVIC interrupt setup was pulled from the us_ticker code even
if no code is using timer events.
This also adds ARM_GCC support for TARGET_LPC81X.
LPC81X and LPC82X support Cortex M0+ VTOR register, so it is not
necessary to put non-init text at 0x200.