Hello,
Using MCUXpresso IDE I can import a lot of examples for al RT microcontroller such as RT1051 or RT1175 (the ones I use)
In all of these examples, the startup file containing the ResetISR function is imported.
This function is declared naked. (see here or here). And the function also contains c code.
Here's what I found on the description of 'naked' here:
in fact even clang-tidy reports it:
src/startup/startup_mimxrt1175_cm7.c:843:5: error: non-ASM statement in naked function is not supported [clang-diagnostic-error]
Is this approach reliable? Or was it a 'casual' decision?
best regards
Max
Hi @mastupristi
There are totally different 2 questions,
1. For 'naked'. Details of 'naked': 'Use this attribute on the ARM or AVR ports to indicate that the specified function do not need prologue/epilogue sequences generated by the compiler. It is up to the programmer to provide these sequences.' https://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Function-Attributes.html 'Hybrid Programming C and asm' depens on the toolchian can support optimize or not, https://developer.arm.com/documentation/101754/0622/armclang-Reference/Compiler-specific-Function--V... armclang
cannot optimize __attribute__((naked))
functions.
2. Please see key explaination about the reason: https://www.freertos.org/Documentation/02-Kernel/05-RTOS-implementation-tutorial/02-Building-blocks/... When the 'naked' attribute is used the compiler(gcc for NXP) does not generate any function entry or exit code so this must now be added explicitly. It is reasonable for ISR reset.
B.R,
Sam