Arm Community
Site
Search
User
Site
Search
User
Groups
Arm Research
DesignStart
Education Hub
Graphics and Gaming
High Performance Computing
Innovation
Multimedia
Open Source Software and Platforms
Physical
Processors
Security
System
Software Tools
TrustZone for Armv8-M
中文社区
Blog
Announcements
Artificial Intelligence
Automotive
Healthcare
HPC
Infrastructure
Innovation
Internet of Things
Machine Learning
Mobile
Smart Homes
Wearables
Forums
All developer forums
IP Product forums
Tool & Software forums
Pelion IoT Platform
Support
Open a support case
Documentation
Downloads
Training
Arm Approved program
Arm Design Reviews
Community Help
More
Cancel
Developer Community
Tools and Software
Software Tools
Jump...
Cancel
Software Tools
Arm Development Studio forum
How handle Cortex-M0 Interrupts on IAR using C++?
Tools, Software and IDEs blog
Forums
Videos & Files
Help
Jump...
Cancel
New
Replies
3 replies
Subscribers
127 subscribers
Views
3678 views
Users
0 members are here
Related
How handle Cortex-M0 Interrupts on IAR using C++?
Offline
Andre Pereira
over 7 years ago
Note: This was originally posted on 30th August 2011 at http://forums.arm.com
[font=Times][size=2][font=arial, verdana, tahoma, sans-serif][size=2]Hello everybody,
I'm using IAR 6.21 compiler and a LPC11C14 IAR's dev board, doing my firsts test with C++.[/size][/font]
Also I'm simulating UART interrupts in the C-SPY simulator, all working great on C, so the problem is not the macros or whatever.
I search on the web how to handle interrupts in C++, and found that:
http://www.eetimes.com/design/embedded/4023817/Interrupts-in-C-
So I did this on my code:
in uart.h:
class uart
{
...
public:
static void UART0_IRQHandler( void );
}
in uart.c:
void uart::UART0_IRQHandler( void );
{
// breakpoint reading the UART receive register
}
And the vector is defined correctly in cstartup_m.s and in the cstartup_m.c (I've tested with either, one per time obviously)
the vector worked fine in C, so it's not the problem.
The problem is my static member is not even linked, the linker uses the default function provided in the vector definition source code.
I tried to figure out what I'm doing wrong and made some other tests also, but no way to establish a connection between the uart interrupt vector and mu static member function.
It works if I "mix" C with C++ using "extern C" definitions, but I believe that should be a "correct" way of doing this.
What I'm doing wrong?
Is this the best way of deal with interrupts in C++?
Thanks in advance buddies.
André Rairan.[/size][/font]
Parents
Offline
Peter Harris
over 7 years ago
Note: This was originally posted on 31st August 2011 at
http://forums.arm.com
The linker is trying to match a C-style function name in the symbol table against a mangled name from the C++ function. There are not identical, so link fails.
So either modify the symbol in the assembler to use the mangled name (non-portable, prone to breakage), or use "extern C" to disable name mangling, which is probably the cleanest fix.
http://en.wikipedia.org/wiki/Name_mangling
Cancel
Up
0
Down
Reply
Cancel
Reply
Offline
Peter Harris
over 7 years ago
Note: This was originally posted on 31st August 2011 at
http://forums.arm.com
The linker is trying to match a C-style function name in the symbol table against a mangled name from the C++ function. There are not identical, so link fails.
So either modify the symbol in the assembler to use the mangled name (non-portable, prone to breakage), or use "extern C" to disable name mangling, which is probably the cleanest fix.
http://en.wikipedia.org/wiki/Name_mangling
Cancel
Up
0
Down
Reply
Cancel
Children
No data
More questions in this forum
By title
By date
By reply count
By view count
By most asked
By votes
By quality
Descending
Ascending
All recent questions
Unread questions
Questions you've participated in
Questions you've asked
Unanswered questions
Answered questions
Questions with suggested answers
Questions with no replies
Suggested Answer
Positioning a function in a Position Independent Executable for ARMV8
0
1654
views
3
replies
Latest
6 days ago
by
Stephen Theobald
Answered
Link a pure binary file to image with scatter file
0
1617
views
3
replies
Latest
7 days ago
by
Ronan Synnott
Answered
Failed to read contents of Internal RAM L1-I_DATA in ARM DS
0
Arm Development Studio
Cache
Debug and Trace Services Layer (DTSL)
4202
views
23
replies
Latest
20 days ago
by
Boon Khai
Suggested Answer
DS-5 connect fail when cortex-r5 is in lock-step mode
0
3872
views
10
replies
Latest
26 days ago
by
Stuart Hirons
Suggested Answer
On Cortex-M4F microcontrollers: is fixed point math faster or floating point?
0
3541
views
10
replies
Latest
27 days ago
by
Ronan Synnott
>
View all questions in Arm Development Studio forum