Commit Graph

45 Commits

Author SHA1 Message Date
chao an fc80c70205 assert: rename __ASSERT to __ASSERT__ to avoid conflict
The definition of __ASSERT has special define in some OS and librarys,
rename to __ASSERT__ to avoid conflict

Signed-off-by: chao an <anchao@xiaomi.com>
2023-10-26 16:21:02 +08:00
chao an a521fd7b82 debug/assert: decouple configuration of show file name feature
add new config CONFIG_ASSERTIONS_FILENAME to library call assert(3) to decouple with CONFIG_DEBUG_ASSERTIONS

| Function         |CONFIG                            | Show filename/line |
| ---              | ---                              | ---                |
|assert(), ASSERT()|CONFIG_ASSERTIONS_FILENAME=y      | Yes                |
|assert(), ASSERT()|CONFIG_ASSERTIONS_FILENAME=n      | No                 |
|DEBUGASSERT()     |CONFIG_DEBUG_ASSERTIONS_FILENAME=y| Yes                |
|DEBUGASSERT()     |CONFIG_DEBUG_ASSERTIONS_FILENAME=n| No                 |

Signed-off-by: chao an <anchao@xiaomi.com>
2023-10-20 02:22:48 +08:00
zhangyuan21 bfab486611 assert: add panic notifier data for notify more information
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-03 03:17:22 -07:00
dongjiuzhu1 6ff4826492 nuttx/bits.h: support GENMASK and GENMASK_ULL
Ref to https://github.com/torvalds/linux/blob/master/include/linux/bits.h

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-29 16:41:31 -03:00
chao an 3ce2796175 assert: disable function/line print if DEBUG_ASSERTIONS_FILENAME disabled
Test on sim/nsh:
(CONFIG_DEBUG_ASSERTIONS=y CONFIG_DEFAULT_SMALL=y)
   text	   data	    bss	    dec	    hex	filename
 423626	  27152	   4128	 454906	  6f0fa	nuttx     /* before */
 417010	  27152	   4128	 448290	  6d722	nuttx     /* after */
  -6616

Signed-off-by: chao an <anchao@xiaomi.com>
2023-06-12 13:36:08 +08:00
zhangyuan21 884be2bdb9 assert: Distinguish between assert and exception
CURRENT_REGS may change during assert handling, so pass
in the 'regs' parameter at the entry point of _assert.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-05-03 14:49:32 +08:00
Xiang Xiao c9b917bcee assert.h: Replace NULL with 0 to avoid including stddef.h
Fix error: 'NULL' undeclared if user include assert.h only

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-24 13:13:43 -06:00
yinshengkai 926bfe5818 include/assert: fix nxstyle
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-03-21 12:09:45 -03:00
yinshengkai 216483f96b include/compiler: replace likely to predict_true
likely is defined repeatedly in an external library

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-03-21 12:09:45 -03:00
yinshengkai cb594a4c9c include: add branch prediction for assert
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-02-23 22:35:33 +08:00
Xiang Xiao 65a04c66a2 libc: Define _assert/__assert to avoid 3rd libary redefine them
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-06 15:04:30 +01:00
chao an dff2192c75 misc/assert: remove const string from assert expression
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-02 15:08:47 +08:00
anjiahao 8a80c6ab28 assert:add a Kconfig option to limit binfile size
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-02-02 01:58:43 +08:00
Xiang Xiao 43e7b13697 assert: Log the assertion expression in case of fail
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-24 15:00:19 -03:00
Ville Juven 172b209f2d sched/assert: Re-implement assert() into user space
_assert is a kernel procedure, entered via system call to make the core
dump in privileged mode.

Running exit() from this context is not OK as it runs the registered
exit functions and flushes streams, which must not be done
from privileged mode as it is a security hole.

Thus, implement assert() into user space (again) and remove the exit()
call from the kernel procedure.
2022-12-22 21:07:47 +08:00
wangbowen6 913c7148e5 assert: static_assert is not support in c standard C89,C99.
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-04-21 23:11:21 +08:00
Xiang Xiao 0dd844d89b assert.h: Don't use UNUSED macro since it's very easy happen conflict
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-02 09:01:36 +01:00
ligd 3cfc6761ff xtensa: fix lack of float register save & resotre
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-01-11 12:17:09 +01:00
Petro Karashchenko 09948a6bbb include/assert.h: remove dependency on stdint.h
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-10 19:55:51 +01:00
Alin Jerpelea b0ddc6e2c5 include: Omni Hoverboards: update licenses to Apache
Gregory Nutt has submitted the SGA
Omni Hoverboards has submitted the SGA
Paul Alexander Patience  has submitted the ICLA

as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-09-28 04:37:38 -07:00
Xiang Xiao 5f3a98b5a8 libc/assert: Reference the expression in all case
to avoid the warning "defined but not used"

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I55b7c092d0f2e5882fc1784987657c10cdf2d90b
2021-04-03 21:00:41 +01:00
Xiang Xiao d6827cab60 arch: up_assert shouldn't call exit directly
since exit will be only callable from userspace and change
the 1st argument from "const uint8_t *" to "const char *"

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I86487d57210ab63109148232da71dbc4d60a563b
2020-07-19 01:21:36 +01:00
Paul A. Patience 983ccf1b0a assert: Don't define static_assert in C++ 2016-06-21 07:17:29 -04:00
Gregory Nutt d1a62f1d24 Add a comment 2016-06-20 14:26:13 -06:00
Paul A. Patience a96c7492ad assert: Define static_assert 2016-06-20 10:29:41 -04:00
Paul A. Patience f995f3c7bf assert: Simplify 2016-06-12 08:18:30 -04:00
Gregory Nutt c211ce8be1 DEBUGASSERT() is not enabled with CONFIG_DEBUG_ASSERTIONS, not CONFIG_DEBUG 2016-06-11 12:49:21 -06:00
Gregory Nutt d84dbbc455 Add a comment to assert.h 2016-06-08 09:59:11 -06:00
Paul A. Patience 79a157cc9d assert: Check if NDEBUG is defined 2016-06-08 11:07:24 -04:00
Gregory Nutt df4e24ddeb include/assert.h: Wrap definitions of assertion macros in do while. Suggested by orbitalfox 2015-04-22 07:35:35 -06:00
Gregory Nutt d11050e978 Add support for the UG-2843HHSWEG04 OLED and for the SAM4L Xplained Pro OLED module that uses that OLED. 2013-06-23 14:39:56 -06:00
Gregory Nutt 0d1cf112cf Changes to remove some warning sduring compilation for ZKit-arm-1769 Board. 2013-05-02 06:28:59 -06:00
Gregory Nutt 86b815373a Remove up_assert_code 2013-04-25 15:19:59 -06:00
patacongo 14298ad8b8 Fixe to kernel build and syscalls.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5738 42af7a65-404d-4744-a932-0658087f49c3
2013-03-13 17:32:37 +00:00
patacongo 1b94639432 Misc clean; mark assertions as non-returning; allow toolchain prefix to be overriden from make command line
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5591 42af7a65-404d-4744-a932-0658087f49c3
2013-01-31 23:29:34 +00:00
patacongo 435dbaacd8 Add configurable application entry point
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5070 42af7a65-404d-4744-a932-0658087f49c3
2012-08-30 20:13:50 +00:00
patacongo f13f49939e Add interface to enabled/disable debug output
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4386 42af7a65-404d-4744-a932-0658087f49c3
2012-02-12 23:54:26 +00:00
patacongo bf0d9cd2ef Add Kinetis IRQ numbers
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3850 42af7a65-404d-4744-a932-0658087f49c3
2011-08-07 16:34:39 +00:00
patacongo eeec4073a9 Switching to C99 stdint.h types
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2340 42af7a65-404d-4744-a932-0658087f49c3
2009-12-14 23:32:23 +00:00
patacongo 85911f6a9d cosmetic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1256 42af7a65-404d-4744-a932-0658087f49c3
2008-11-16 16:36:30 +00:00
patacongo 8d2f18e709 More z8 compilation changes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@671 42af7a65-404d-4744-a932-0658087f49c3
2008-02-12 14:37:55 +00:00
patacongo bece513004 SDCC specific changes. Z80 support; re-enable __FILE__ and __LINE__ in assert -- might have broken the 8051/2
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@277 42af7a65-404d-4744-a932-0658087f49c3
2007-06-09 20:31:09 +00:00
patacongo a60059d9d0 Finally, a clean SDCC compile
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@20 42af7a65-404d-4744-a932-0658087f49c3
2007-02-27 21:17:21 +00:00
patacongo b8f3bd857b Progress toward clean SDCC compilation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@18 42af7a65-404d-4744-a932-0658087f49c3
2007-02-21 21:55:16 +00:00
patacongo b08a86171f NuttX RTOS
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3 42af7a65-404d-4744-a932-0658087f49c3
2007-02-17 23:21:28 +00:00