Add a "noreturn" attribute to 'scb_reset_system'

Adding this attribute allows to avoid warnings issued by GCC in cases
when 'scb_reset_system' is used as a last call in a function with
"noreturn" attribute set(usually reset handler of some sorts)
This commit is contained in:
Andrey Smirnov 2013-02-01 23:58:57 -08:00 committed by Piotr Esden-Tempski
parent e944876b63
commit 6cb7d8abf3
2 changed files with 8 additions and 2 deletions

View File

@ -382,8 +382,8 @@ struct scb_exception_stack_frame {
: [frameptr]"=r" (f)); \
} while (0)
void scb_reset_core(void);
void scb_reset_system(void);
void scb_reset_core(void) __attribute__((noreturn, naked));
void scb_reset_system(void) __attribute__((noreturn, naked));
void scb_set_priority_grouping(u32 prigroup);
/* TODO: */

View File

@ -17,16 +17,22 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <libopencm3/cm3/scb.h>
void scb_reset_core(void)
{
SCB_AIRCR = SCB_AIRCR_VECTKEY | SCB_AIRCR_VECTRESET;
exit(1);
}
void scb_reset_system(void)
{
SCB_AIRCR = SCB_AIRCR_VECTKEY | SCB_AIRCR_SYSRESETREQ;
exit(1);
}
void scb_set_priority_grouping(u32 prigroup)