From 6cb7d8abf323627683b7cfb24e59b6f2884926ba Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Fri, 1 Feb 2013 23:58:57 -0800 Subject: [PATCH] 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) --- include/libopencm3/cm3/scb.h | 4 ++-- lib/cm3/scb.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/libopencm3/cm3/scb.h b/include/libopencm3/cm3/scb.h index a440cb13..febb863c 100644 --- a/include/libopencm3/cm3/scb.h +++ b/include/libopencm3/cm3/scb.h @@ -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: */ diff --git a/lib/cm3/scb.c b/lib/cm3/scb.c index 904bd7c1..098c00a4 100644 --- a/lib/cm3/scb.c +++ b/lib/cm3/scb.c @@ -17,16 +17,22 @@ * along with this library. If not, see . */ +#include + #include 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)