Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imxrt fixes #1

Merged
merged 5 commits into from
Dec 24, 2019
Merged

imxrt fixes #1

merged 5 commits into from
Dec 24, 2019

Conversation

davids5
Copy link
Contributor

@davids5 davids5 commented Dec 21, 2019

In bringing up the NXP RDDRONE-FMURT6 these issues were discovered and fixed.

  • False detection
  • No Detection I2C
  • System lock up hang due to interrupt storm

Prior to this PR

NuttShell (NSH)
nsh>  i2cdetect -b 1
Scanning I2C bus: 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
nsh>  i2cdetect -b 2
Scanning I2C bus: 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d <HUNG>

Top Traces are the I2C IRQ, SPI IRQ and CPU IRQ,
Big Picture
image
Focus on Storm
image
The Storm rate.
image

With this PR

NuttShell (NSH)
nsh>  i2cdetect -b 1
Scanning I2C bus: 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- 0e --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- 55 -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
nsh>  i2cdetect -b 2
Scanning I2C bus: 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- 1e --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

image

imxrt:gpio ran through nxstyle
   Reworked imxrt_lpi2c_reset to use GPIO because the IO
   can not be mapped from a peripheral to a GPIO with
   simple bit logic.
   After an error the STOP detect was overwriting the
   previous error status.
   The SDF was not acked if ther was an error
   on the last write.
@davids5 davids5 requested a review from patacongo December 21, 2019 11:42
@davids5 davids5 added the Type: Bug Something isn't working label Dec 21, 2019
@davids5 davids5 marked this pull request as ready for review December 21, 2019 11:47
@Apache9
Copy link

Apache9 commented Dec 21, 2019

So we will merge PR to master branch directly? No dev branch?

@davids5 davids5 requested review from acassis and Ouss4 and removed request for patacongo December 21, 2019 17:18
@davids5
Copy link
Contributor Author

davids5 commented Dec 21, 2019

So we will merge PR to master branch directly? No dev branch?

@Apache9
As it stands master has been dev. If we had release branches then master could still be dev. But all this is yet to be seen.

I will let this sit until the PPMC votes on work flow. I only needed it merged to backport to the PX4 stable version of nuttx 8.2. It was important because it cause the OS to hang.

I usually prefer to back-port after Greg has applied the patch or PR and then fixed things his subsequent commits. That way the back port == upstream.

But I can carry the commits without the [BACKPORT] marker in PX4 for now.

We should warn all the NXP IMXRT and I think NXP S32K users the code will hang the OS.

@patacongo
Copy link
Contributor

'master' has never been 'dev' in this repository. You are thinking of a different repository that was managed by a single person.

@davids5
Copy link
Contributor Author

davids5 commented Dec 22, 2019

'master' has never been 'dev' in this repository. You are thinking of a different repository that was managed by a single person.

Yes - I am so glad you are so exacting - I was referring to historically before NuttX joined ASF. Most recently in the repo hosted on bitbucket, with Greg as the sole committer.

@patacongo
Copy link
Contributor

With a single committer, you can greatly simplify things since it is the sole reponsibility of that single committed to go from the patch to PR to its clean incorporation. It requires more discipline to work as a group.
PS: I always hated the PRs to master in the Bitbucket repsitories. But I never hated all PRs as you said. I should have set up a 'dev' branch and made sure that all PRs were against the 'dev' branch. Although it does take a little effort to keep a dev branch up to date.

@btashton
Copy link
Contributor

@davids5 This touches some of the same IO stuff that I have been working on on the imxrt platform, some of the changes are style. Did you make these changes via one of the existing tools, or was this manual. I want to make sure my changes apply cleanly on top of this. For now I will carry this in my tree.

@jarivanewijk
Copy link
Contributor

jarivanewijk commented Dec 23, 2019

Thank you for your work, @davids5!

We should warn all the NXP IMXRT and I think NXP S32K users the code will hang the OS.

A lot of the peripheral code for S32K seems to be taken from i.MX RT, so it is likely affected by this is as well. There are probably not many S32K users yet, though. We are working at NXP to improve the support for the S32K1xx and their evaluation boards. The progress is slow but steady. After the holidays I will apply your fixes to S32K on our internal NuttX repository. We will open a PR here eventually. (January/February?)

@davids5
Copy link
Contributor Author

davids5 commented Dec 23, 2019

Thank you for your work, @davids5!

We should warn all the NXP IMXRT and I think NXP S32K users the code will hang the OS.

A lot of the peripheral code for S32K seems to be taken from i.MX RT, so it is likely affected by this is as well. There are probably not many S32K users yet, though. We are working at NXP to improve the support for the S32K1xx and their evaluation boards. The progress is slow but steady. After the holidays I will apply your fixes to S32K on our internal NuttX repository. We will open a PR here eventually. (January/February?)

@jarivanewijk - yes exactly. It was cloned by @patacongo before I had the RDDRONE-FMURT6 HW to validate it on. It may be marked EXPERIMENTAL , but I have not followed it's progress.

I will ask @igalloway for HW and I can cross check locally as well.

@davids5
Copy link
Contributor Author

davids5 commented Dec 23, 2019

@btashton

@davids5 This touches some of the same IO stuff that I have been working on on the imxrt platform, some of the changes are style. Did you make these changes via one of the existing tools, or was this manual. I want to make sure my changes apply cleanly on top of this. For now I will carry this in my tree.

yeah - we really should talk this through. I had a very detailed discussion on yahoo on what we had learned from the STM32 organically grown nightmare.

The gist of it is: There are clear patterns that should be use when there is a chip family.

@mubes make some great strides in this on the RT, but took some shortcuts when the imxrt20 came in. We should not follow that pattern.

All the gpio tables need to broken out and the included like the clockconfig does STM32 or the dasiy does n the imxrt.

#ifddef rash has to be avoided or kept to a minimum. It use to be before the 20 commit.
Scope has to be be maintained.

Let' plan a call then bring it back to the list.

@mubes
Copy link
Contributor

mubes commented Dec 23, 2019

Way back when DavidS and I talked about this at length and then there was a lot of work done in imxrt to split it into the different chips - 1050, 60 and 20 to form the various hardware/rt10xx directories.

At the moment the only place there is any family member selection (other than to pull in the correct chip specific subdir) is in imxrt_clockconfig.c, imxrt_gpio.c and imxrt_iomux.c. Those can (and probably should) be refactored into the same pattern as the other files which, I think, would keep the structure clean.

Does that satisfy your concern @btashton , or are you looking for a more fundamental restructure? (BTW, this structure is a nicer way of highlighting changes and having proper discussion about them to find the best way forward).

DAVE

@btashton
Copy link
Contributor

@mubes No complaints on my end (beyond the tedious task of transcribing datasheets to code). This family has been handled so much better by NXP than ST did with the STM32 family.

There are a few things I have tweaked across all of the devices, but that is mostly minor and usually just using a better define for example because not all have PADMUX_WAKEUP:

-  if (index >= IMXRT_PADMUX_WAKEUP_INDEX)
+  if (index >= IMXRT_PADMUX_SNVS_START_INDEX)

Also a couple typeo's like

-#define GPIO_LPSPI1_SDI_2              (GPIO_PERIPH | GPIO_ALT4 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_SD_B0_05_INDEX))fb
+#define GPIO_LPSPI1_SDI_2              (GPIO_PERIPH | GPIO_ALT4 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_SD_B0_05_INDEX))

There is also a GPIOMUX that they added to help with the lower pincount while still allowing high speed GPIO. Anyway I need to just get this stuff out for comment. Probably need a couple nights to get the core code done, not sure how long the board bit will take. The memory interfaces are a little different.

Anyway this is getting off topic for this PR. I'll put a DRAFT PR up before I get the board code done, either a here or on my fork.

@davids5 I have not forgotten about your offer, just will likely need to wait until the 1st with travel.

@mubes
Copy link
Contributor

mubes commented Dec 23, 2019

Yeah, lets move this onto another PR so we can fix up whatever needs to be done to solidify the filesystem structure for the rt's. Certainly I think moving the GPIOs, IOMUX and ClockConfig into the subdirectory will go a long way to fixing whats outstanding (well, that and fixing Mr. Hamfisteds' typos).

DAVE

@patacongo patacongo merged commit 10c4aff into master Dec 24, 2019
@patacongo patacongo deleted the master_imxrt branch December 24, 2019 01:08
anchao referenced this pull request in anchao/nuttx Jun 15, 2020
ASAN trace:
...
==32087==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf4502120 at pc 0x56673ca3 bp 0xff9b6a08 sp 0xff9b69f8
WRITE of size 1 at 0xf4502120 thread T0
    #0 0x56673ca2 in strcpy string/lib_strcpy.c:64

0xf4502120 is located 0 bytes to the right of 8224-byte region [0xf4500100,0xf4502120)
allocated by thread T0 here:
    #0 0xf7a60f54 in malloc (/usr/lib32/libasan.so.4+0xe5f54)
    #1 0x5667725d in up_create_stack sim/up_createstack.c:135
    #2 0x56657ed8 in nxthread_create task/task_create.c:125
    #3 0x566580bb in kthread_create task/task_create.c:297
    #4 0x5665935f in work_start_highpri wqueue/kwork_hpthread.c:149
    #5 0x56656f31 in nx_workqueues init/nx_bringup.c:181
    #6 0x56656fc6 in nx_bringup init/nx_bringup.c:436
    apache#7 0x56656e95 in nx_start init/nx_start.c:809
    apache#8 0x566548d4 in main sim/up_head.c:95
    apache#9 0xf763ae80 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18e80)

CALLSTACK:
    apache#8  0xf79de7a5 in __asan_report_store1 () from /usr/lib32/libasan.so.4
    apache#9  0x565fd4d7 in strcpy (dest=0xf4a02121 "", src=0xf5c00895 "k") at string/lib_strcpy.c:64
    apache#10 0x565e4eb2 in nxtask_setup_stackargs (tcb=0xf5c00810, argv=0x0) at task/task_setup.c:570
    apache#11 0x565e50ff in nxtask_setup_arguments (tcb=0xf5c00810, name=0x5679e580 "hpwork", argv=0x0) at task/task_setup.c:714
    apache#12 0x565e414e in nxthread_create (name=0x5679e580 "hpwork", ttype=2 '\002', priority=224, stack=0x0, stack_size=8192, entry=0x565e54e1 <work_hpthread>, argv=0x0) at task/task_create.c:143
    apache#13 0x565e42e3 in kthread_create (name=0x5679e580 "hpwork", priority=224, stack_size=8192, entry=0x565e54e1 <work_hpthread>, argv=0x0) at task/task_create.c:297
    apache#14 0x565e5557 in work_start_highpri () at wqueue/kwork_hpthread.c:149
    apache#15 0x565e3e32 in nx_workqueues () at init/nx_bringup.c:181
    apache#16 0x565e3ec7 in nx_bringup () at init/nx_bringup.c:436
    apache#17 0x565e3d96 in nx_start () at init/nx_start.c:809
    apache#18 0x565e3195 in main (argc=1, argv=0xffe6b954, envp=0xffe6b95c) at sim/up_head.c:95

Change-Id: I096f7952aae67d055daa737e967242eb217ef8ac
Signed-off-by: chao.an <[email protected]>
patacongo pushed a commit that referenced this pull request Jun 15, 2020
ASAN trace:
...
==32087==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf4502120 at pc 0x56673ca3 bp 0xff9b6a08 sp 0xff9b69f8
WRITE of size 1 at 0xf4502120 thread T0
    #0 0x56673ca2 in strcpy string/lib_strcpy.c:64

0xf4502120 is located 0 bytes to the right of 8224-byte region [0xf4500100,0xf4502120)
allocated by thread T0 here:
    #0 0xf7a60f54 in malloc (/usr/lib32/libasan.so.4+0xe5f54)
    #1 0x5667725d in up_create_stack sim/up_createstack.c:135
    #2 0x56657ed8 in nxthread_create task/task_create.c:125
    #3 0x566580bb in kthread_create task/task_create.c:297
    #4 0x5665935f in work_start_highpri wqueue/kwork_hpthread.c:149
    #5 0x56656f31 in nx_workqueues init/nx_bringup.c:181
    #6 0x56656fc6 in nx_bringup init/nx_bringup.c:436
    #7 0x56656e95 in nx_start init/nx_start.c:809
    #8 0x566548d4 in main sim/up_head.c:95
    #9 0xf763ae80 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18e80)

CALLSTACK:
    #8  0xf79de7a5 in __asan_report_store1 () from /usr/lib32/libasan.so.4
    #9  0x565fd4d7 in strcpy (dest=0xf4a02121 "", src=0xf5c00895 "k") at string/lib_strcpy.c:64
    #10 0x565e4eb2 in nxtask_setup_stackargs (tcb=0xf5c00810, argv=0x0) at task/task_setup.c:570
    #11 0x565e50ff in nxtask_setup_arguments (tcb=0xf5c00810, name=0x5679e580 "hpwork", argv=0x0) at task/task_setup.c:714
    #12 0x565e414e in nxthread_create (name=0x5679e580 "hpwork", ttype=2 '\002', priority=224, stack=0x0, stack_size=8192, entry=0x565e54e1 <work_hpthread>, argv=0x0) at task/task_create.c:143
    #13 0x565e42e3 in kthread_create (name=0x5679e580 "hpwork", priority=224, stack_size=8192, entry=0x565e54e1 <work_hpthread>, argv=0x0) at task/task_create.c:297
    #14 0x565e5557 in work_start_highpri () at wqueue/kwork_hpthread.c:149
    #15 0x565e3e32 in nx_workqueues () at init/nx_bringup.c:181
    #16 0x565e3ec7 in nx_bringup () at init/nx_bringup.c:436
    #17 0x565e3d96 in nx_start () at init/nx_start.c:809
    #18 0x565e3195 in main (argc=1, argv=0xffe6b954, envp=0xffe6b95c) at sim/up_head.c:95

Change-Id: I096f7952aae67d055daa737e967242eb217ef8ac
Signed-off-by: chao.an <[email protected]>
xiaoxiang781216 pushed a commit that referenced this pull request Sep 23, 2024
When exec "echo 1 > /proc/thermal/cpu-thermal", procfs get "\n" after "1", treat as disable:
```
 #1  0x000000000040f452 in thermal_procfs_write (filep=0x7ffff3d241e8, buffer=0x7ffff3d344fc "\n", buflen=1) at thermal/thermal_procfs.c:179
```

Signed-off-by: wangjianyu3 <[email protected]>
jasonbu pushed a commit to jasonbu/nuttx that referenced this pull request Sep 27, 2024
ap> cat pm
=================================================================
==30235==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf436edd9 at pc 0x03338a48 bp 0x9d1b6ca8 sp 0x9d1b6c98
READ of size 1 at 0xf436edd9 thread T0
    #0 0x3338a47 in strncmp string/lib_strncmp.c:42
    apache#1 0x371af87 in pm_get_file_index power/pm/pm_procfs.c:174
    apache#2 0x371b066 in pm_open power/pm/pm_procfs.c:207
    apache#3 0x3640d20 in procfs_open procfs/fs_procfs.c:419
    apache#4 0x359bce2 in file_vopen vfs/fs_open.c:240
    apache#5 0x359c431 in nx_vopen vfs/fs_open.c:312
    apache#6 0x359cb53 in open vfs/fs_open.c:465
    apache#7 0x33bccc9 in nsh_catfile /apps/nshlib/nsh_fsutils.c:140
    apache#8 0x33b28cc in cmd_cat /apps/nshlib/nsh_fscmds.c:556
    apache#9 0x33a434f in nsh_command /apps/nshlib/nsh_command.c:1164
    apache#10 0x3381b8f in nsh_execute /apps/nshlib/nsh_parse.c:845
    apache#11 0x338dc17 in nsh_parse_command /apps/nshlib/nsh_parse.c:2744
    apache#12 0x338e273 in nsh_parse /apps/nshlib/nsh_parse.c:2828
    apache#13 0x3390b47 in nsh_session /apps/nshlib/nsh_session.c:245
    apache#14 0x337e90a in nsh_consolemain /apps/nshlib/nsh_consolemain.c:75
    apache#15 0x337e7f7 in nsh_main /apps/system/nsh/nsh_main.c:74
    apache#16 0x332b6e6 in nxtask_startup sched/task_startup.c:70
    apache#17 0x323ec3f in nxtask_start task/task_start.c:134
    apache#18 0x33636ea in pre_start sim/sim_initialstate.c:52

ap> cat net
=================================================================
==30303==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf4479a5a at pc 0x03338a48 bp 0x9d2b6ce8 sp 0x9d2b6cd8
READ of size 1 at 0xf4479a5a thread T0
    #0 0x3338a47 in strncmp string/lib_strncmp.c:42
    apache#1 0x5395d62 in netprocfs_open procfs/net_procfs.c:215
    apache#2 0x3640d20 in procfs_open procfs/fs_procfs.c:419
    apache#3 0x359bce2 in file_vopen vfs/fs_open.c:240
    apache#4 0x359c431 in nx_vopen vfs/fs_open.c:312
    apache#5 0x359cb53 in open vfs/fs_open.c:465
    apache#6 0x33bccc9 in nsh_catfile /apps/nshlib/nsh_fsutils.c:140
    apache#7 0x33b28cc in cmd_cat /apps/nshlib/nsh_fscmds.c:556
    apache#8 0x33a434f in nsh_command /apps/nshlib/nsh_command.c:1164
    apache#9 0x3381b8f in nsh_execute /apps/nshlib/nsh_parse.c:845
    apache#10 0x338dc17 in nsh_parse_command /apps/nshlib/nsh_parse.c:2744
    apache#11 0x338e273 in nsh_parse /apps/nshlib/nsh_parse.c:2828
    apache#12 0x3390b47 in nsh_session /apps/nshlib/nsh_session.c:245
    apache#13 0x337e90a in nsh_consolemain /apps/nshlib/nsh_consolemain.c:75
    apache#14 0x337e7f7 in nsh_main /apps/system/nsh/nsh_main.c:74
    apache#15 0x332b6e6 in nxtask_startup sched/task_startup.c:70
    apache#16 0x323ec3f in nxtask_start task/task_start.c:134
    apache#17 0x33636ea in pre_start sim/sim_initialstate.c:52

Signed-off-by: dulibo1 <[email protected]>
Signed-off-by: buxiasen <[email protected]>
xiaoxiang781216 pushed a commit that referenced this pull request Sep 27, 2024
ap> cat pm
=================================================================
==30235==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf436edd9 at pc 0x03338a48 bp 0x9d1b6ca8 sp 0x9d1b6c98
READ of size 1 at 0xf436edd9 thread T0
    #0 0x3338a47 in strncmp string/lib_strncmp.c:42
    #1 0x371af87 in pm_get_file_index power/pm/pm_procfs.c:174
    #2 0x371b066 in pm_open power/pm/pm_procfs.c:207
    #3 0x3640d20 in procfs_open procfs/fs_procfs.c:419
    #4 0x359bce2 in file_vopen vfs/fs_open.c:240
    #5 0x359c431 in nx_vopen vfs/fs_open.c:312
    #6 0x359cb53 in open vfs/fs_open.c:465
    #7 0x33bccc9 in nsh_catfile /apps/nshlib/nsh_fsutils.c:140
    #8 0x33b28cc in cmd_cat /apps/nshlib/nsh_fscmds.c:556
    #9 0x33a434f in nsh_command /apps/nshlib/nsh_command.c:1164
    #10 0x3381b8f in nsh_execute /apps/nshlib/nsh_parse.c:845
    #11 0x338dc17 in nsh_parse_command /apps/nshlib/nsh_parse.c:2744
    #12 0x338e273 in nsh_parse /apps/nshlib/nsh_parse.c:2828
    #13 0x3390b47 in nsh_session /apps/nshlib/nsh_session.c:245
    #14 0x337e90a in nsh_consolemain /apps/nshlib/nsh_consolemain.c:75
    #15 0x337e7f7 in nsh_main /apps/system/nsh/nsh_main.c:74
    #16 0x332b6e6 in nxtask_startup sched/task_startup.c:70
    #17 0x323ec3f in nxtask_start task/task_start.c:134
    #18 0x33636ea in pre_start sim/sim_initialstate.c:52

ap> cat net
=================================================================
==30303==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf4479a5a at pc 0x03338a48 bp 0x9d2b6ce8 sp 0x9d2b6cd8
READ of size 1 at 0xf4479a5a thread T0
    #0 0x3338a47 in strncmp string/lib_strncmp.c:42
    #1 0x5395d62 in netprocfs_open procfs/net_procfs.c:215
    #2 0x3640d20 in procfs_open procfs/fs_procfs.c:419
    #3 0x359bce2 in file_vopen vfs/fs_open.c:240
    #4 0x359c431 in nx_vopen vfs/fs_open.c:312
    #5 0x359cb53 in open vfs/fs_open.c:465
    #6 0x33bccc9 in nsh_catfile /apps/nshlib/nsh_fsutils.c:140
    #7 0x33b28cc in cmd_cat /apps/nshlib/nsh_fscmds.c:556
    #8 0x33a434f in nsh_command /apps/nshlib/nsh_command.c:1164
    #9 0x3381b8f in nsh_execute /apps/nshlib/nsh_parse.c:845
    #10 0x338dc17 in nsh_parse_command /apps/nshlib/nsh_parse.c:2744
    #11 0x338e273 in nsh_parse /apps/nshlib/nsh_parse.c:2828
    #12 0x3390b47 in nsh_session /apps/nshlib/nsh_session.c:245
    #13 0x337e90a in nsh_consolemain /apps/nshlib/nsh_consolemain.c:75
    #14 0x337e7f7 in nsh_main /apps/system/nsh/nsh_main.c:74
    #15 0x332b6e6 in nxtask_startup sched/task_startup.c:70
    #16 0x323ec3f in nxtask_start task/task_start.c:134
    #17 0x33636ea in pre_start sim/sim_initialstate.c:52

Signed-off-by: dulibo1 <[email protected]>
Signed-off-by: buxiasen <[email protected]>
xiaoxiang781216 pushed a commit that referenced this pull request Oct 11, 2024
set CONFIG_PRIORITY_INHERITANCE=y
set CONFIG_SEM_PREALLOCHOLDERS=0

semaphore/sem_holder.c:320:34: runtime error: member access within null pointer of type 'struct tcb_s'
    #0 0xd8b540 in nxsem_boostholderprio semaphore/sem_holder.c:320
    #1 0xd8c1cf in nxsem_boost_priority semaphore/sem_holder.c:703
    #2 0xda5dfa in nxsem_wait semaphore/sem_wait.c:145
    #3 0xda61d9 in nxsem_wait_uninterruptible semaphore/sem_wait.c:248
    #4 0x12f2477 in media_service_thread0 /home/ligd/platform/dev/apps/examples/hello/hello_main.c:44
    #5 0x1204154 in pthread_startup pthread/pthread_create.c:59
    #6 0x1cd906f in pthread_start pthread/pthread_create.c:139
    #7 0xe72fcb in pre_start sim/sim_initialstate.c:52

Signed-off-by: ligd <[email protected]>
xiaoxiang781216 pushed a commit that referenced this pull request Oct 13, 2024
note/note_driver.c:1405:11: runtime error: null pointer passed as argument 2, which is declared to never be null
    #0 0x33bf5cc in sched_note_event_ip note/note_driver.c:1405
    #1 0x33bfb57 in note_driver_instrument_enter note/note_initialize.c:55
    #2 0x347b084 in __cyg_profile_func_enter misc/lib_instrument.c:68
    #3 0x34179de in binder_initialize binder/binder.c:669
    #4 0x339a936 in drivers_initialize /home/cuiziwei/vela/happy/nuttx/drivers/drivers_initialize.c:242
    #5 0x335a179 in nx_start init/nx_start.c:632
    #6 0x32f755c in main sim/sim_head.c:180
    #7 0xf6821518  (/lib/i386-linux-gnu/libc.so.6+0x21518) (BuildId: 7f64b917aaa97b9680d8e44931bf7611c5a1f036)
    #8 0xf68215f2 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x215f2) (BuildId: 7f64b917aaa97b9680d8e44931bf7611c5a1f036)
    #9 0x32b401a in _start (/home/cuiziwei/vela/happy/nuttx/nuttx+0x32b401a) (BuildId: 33f8f7b361d44a008de87fea1bc970b22b48b700)

Signed-off-by: cuiziwei <[email protected]>
pkarashchenko pushed a commit that referenced this pull request Oct 15, 2024
stdio/lib_libvsprintf.c:1018:17: runtime error: negation of -9223372036854775808 cannot be
represented in type 'long long int'; cast to an unsigned type to negate this value to itself
    #0 0x3326a86 in vsprintf_internal stdio/lib_libvsprintf.c:1018
    #1 0x332926b in lib_vsprintf stdio/lib_libvsprintf.c:1363
    #2 0x3777978 in vfprintf stdio/lib_vfprintf.c:52
    #3 0x671b3a0 in printf stdio/lib_printf.c:44
    #4 0x37abc0c in hello_main /data/project/code/vela-pt/apps/examples/hello/hello_main.c:38
    #5 0x33201d3 in nxtask_startup sched/task_startup.c:70
    #6 0x3208ecb in nxtask_start task/task_start.c:134
    #7 0x3357a49 in pre_start sim/sim_initialstate.c:52

Signed-off-by: Bowen Wang <[email protected]>
hiccupzhu pushed a commit to hiccupzhu/nuttx that referenced this pull request Oct 16, 2024
sim/posix/sim_offload.c:369:18: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
    #0 0x3a146c2  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x3a146c2)
    apache#1 0x3a0ecb0  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x3a0ecb0)
    apache#2 0x3a1193a  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x3a1193a)
    apache#3 0x3a13141  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x3a13141)
    apache#4 0x39fc3ef  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x39fc3ef)
    apache#5 0x38ca7f2  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x38ca7f2)
    apache#6 0x39fc6cf  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x39fc6cf)

Signed-off-by: qiaohaijiao1 <[email protected]>
hiccupzhu pushed a commit to hiccupzhu/nuttx that referenced this pull request Oct 16, 2024
sim/posix/sim_offload.c:369:18: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
    #0 0x3a146c2  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x3a146c2)
    apache#1 0x3a0ecb0  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x3a0ecb0)
    apache#2 0x3a1193a  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x3a1193a)
    apache#3 0x3a13141  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x3a13141)
    apache#4 0x39fc3ef  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x39fc3ef)
    apache#5 0x38ca7f2  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x38ca7f2)
    apache#6 0x39fc6cf  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x39fc6cf)

Signed-off-by: qiaohaijiao1 <[email protected]>
xiaoxiang781216 pushed a commit that referenced this pull request Oct 16, 2024
sim/posix/sim_offload.c:369:18: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
    #0 0x3a146c2  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x3a146c2)
    #1 0x3a0ecb0  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x3a0ecb0)
    #2 0x3a1193a  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x3a1193a)
    #3 0x3a13141  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x3a13141)
    #4 0x39fc3ef  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x39fc3ef)
    #5 0x38ca7f2  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x38ca7f2)
    #6 0x39fc6cf  (/home/qiaohj/disk1/work/vela/nuttx/nuttx+0x39fc6cf)

Signed-off-by: qiaohaijiao1 <[email protected]>
yangguangcai01 referenced this pull request in yangguangcai01/nuttx Oct 16, 2024
RTOSXMDPYX-575

string/lib_strcpy.c:87:15: runtime error: signed integer overflow: -2132367969 - 16843009 cannot be represented in type 'long int'
    #0 0x48e77096 in strcpy string/lib_strcpy.c:87
    #1 0x535b6ea4 in libconfig_strbuf_append_string libconfig/lib/strbuf.c:60
    apache#2 0x53ad7f52 in libconfig_yyparse /home/ygc/ssd/x4b-sim/external/libconfig/grammar.y:186
    apache#3 0x5358d281 in __config_read libconfig/lib/libconfig.c:561
    apache#4 0x5358dea0 in config_read_file libconfig/lib/libconfig.c:677
    apache#5 0x52cdd0a5 in tts_vendor_list_get src/vendor.c:114
    apache#6 0x52cde739 in default_tts_vendor_get src/vendor.c:356
    apache#7 0x52a07e1d in vendorswitch_init src/vendorswitch/vendorswitch.c:501
    apache#8 0x52444fb9 in mico_misc_main /home/ygc/ssd/x4b-sim/vendor/xiaomi/miai/mico_misc/instance/main.c:72
    apache#9 0x48bee720 in nxtask_startup sched/task_startup.c:70
    apache#10 0x48b41eb4 in nxtask_start task/task_start.c:112
    apache#11 0x48c1ef3d in pre_start sim/sim_initialstate.c:52

Change-Id: I6e969ce530edefdf4307d36dc6944dcf7ce5958f
Signed-off-by: yangguangcai <[email protected]>
yangguangcai01 referenced this pull request in yangguangcai01/nuttx Oct 16, 2024
string/lib_strcpy.c:87:15: runtime error: signed integer overflow: -2132367969 - 16843009 cannot be represented in type 'long int'
    #0 0x48e77096 in strcpy string/lib_strcpy.c:87
    #1 0x535b6ea4 in libconfig_strbuf_append_string libconfig/lib/strbuf.c:60
    apache#2 0x53ad7f52 in libconfig_yyparse /home/ygc/ssd/x4b-sim/external/libconfig/grammar.y:186
    apache#3 0x5358d281 in __config_read libconfig/lib/libconfig.c:561
    apache#4 0x5358dea0 in config_read_file libconfig/lib/libconfig.c:677
    apache#5 0x52cdd0a5 in tts_vendor_list_get src/vendor.c:114
    apache#6 0x52cde739 in default_tts_vendor_get src/vendor.c:356
    apache#7 0x52a07e1d in vendorswitch_init src/vendorswitch/vendorswitch.c:501
    apache#8 0x52444fb9 in mico_misc_main /home/ygc/ssd/x4b-sim/vendor/xiaomi/miai/mico_misc/instance/main.c:72
    apache#9 0x48bee720 in nxtask_startup sched/task_startup.c:70
    apache#10 0x48b41eb4 in nxtask_start task/task_start.c:112
    apache#11 0x48c1ef3d in pre_start sim/sim_initialstate.c:52

Signed-off-by: yangguangcai <[email protected]>
xiaoxiang781216 pushed a commit that referenced this pull request Oct 17, 2024
string/lib_strcpy.c:87:15: runtime error: signed integer overflow: -2132367969 - 16843009 cannot be represented in type 'long int'
    #0 0x48e77096 in strcpy string/lib_strcpy.c:87
    #1 0x535b6ea4 in libconfig_strbuf_append_string libconfig/lib/strbuf.c:60
    #2 0x53ad7f52 in libconfig_yyparse /home/ygc/ssd/x4b-sim/external/libconfig/grammar.y:186
    #3 0x5358d281 in __config_read libconfig/lib/libconfig.c:561
    #4 0x5358dea0 in config_read_file libconfig/lib/libconfig.c:677
    #5 0x52cdd0a5 in tts_vendor_list_get src/vendor.c:114
    #6 0x52cde739 in default_tts_vendor_get src/vendor.c:356
    #7 0x52a07e1d in vendorswitch_init src/vendorswitch/vendorswitch.c:501
    #8 0x52444fb9 in mico_misc_main /home/ygc/ssd/x4b-sim/vendor/xiaomi/miai/mico_misc/instance/main.c:72
    #9 0x48bee720 in nxtask_startup sched/task_startup.c:70
    #10 0x48b41eb4 in nxtask_start task/task_start.c:112
    #11 0x48c1ef3d in pre_start sim/sim_initialstate.c:52

Signed-off-by: yangguangcai <[email protected]>
pwnall pushed a commit to pwnall/nuttx that referenced this pull request Oct 23, 2024
Deadlock during recursive access if unionfs overlays procfs,
check the critical segment only and remove the useless protection part.

|#0  unionfs_statfs (mountpt=0xf3df4540, buf=0xf3de2f0c) at unionfs/fs_unionfs.c:2136
...
|apache#6  0x08069429 in procfs_read (filep=0xf3df4574, buffer=0xf3df4610 "...", buflen=1024) at procfs/fs_procfs.c:412
|apache#7  0x0806c339 in unionfs_read (filep=0xf3de219c, buffer=0xf3df4610 "...", buflen=1024) at unionfs/fs_unionfs.c:1026

original call stack:
(gdb) bt
|#0  unionfs_statfs (mountpt=0xf3df4540, buf=0xf3de2f0c) at unionfs/fs_unionfs.c:2136
|apache#1  0x08071629 in mountpoint_filter (node=0xf3df4540, dirpath=0xf3df4a28 "/proc", arg=0xf3de2fc4) at mount/fs_foreachmountpoint.c:119
|apache#2  0x0807171b in foreach_inodelevel (node=0xf3df4540, info=0xf3df4a20) at inode/fs_foreachinode.c:90
|apache#3  0x08071898 in foreach_inode (handler=0x8071530 <mountpoint_filter>, arg=0xf3de2fc4) at inode/fs_foreachinode.c:193
|apache#4  0x080716c1 in foreach_mountpoint (handler=0x8070e2f <blocks_entry>, arg=0xf3de300c) at mount/fs_foreachmountpoint.c:169
|apache#5  0x08071399 in mount_read (filep=0xf3df4574, buffer=0xf3df4610 "...", buflen=1024) at mount/fs_procfs_mount.c:537
|apache#6  0x08069429 in procfs_read (filep=0xf3df4574, buffer=0xf3df4610 "...", buflen=1024) at procfs/fs_procfs.c:412
|apache#7  0x0806c339 in unionfs_read (filep=0xf3de219c, buffer=0xf3df4610 "...", buflen=1024) at unionfs/fs_unionfs.c:1026
|apache#8  0x080657a2 in file_read (filep=0xf3de219c, buf=0xf3df4610, nbytes=1024) at vfs/fs_read.c:110
|apache#9  0x0806581a in nx_read (fd=3, buf=0xf3df4610, nbytes=1024) at vfs/fs_read.c:175
|apache#10 0x08065847 in read (fd=3, buf=0xf3df4610, nbytes=1024) at vfs/fs_read.c:206
|apache#11 0x0805a242 in nsh_catfile (vtbl=0xf3df3f10, cmd=0xf3df4378 "df", filepath=0x808d5ed "/proc/fs/blocks") at nsh_fsutils.c:116
|apache#12 0x0805b1de in cmd_df (vtbl=0xf3df3f10, argc=1, argv=0xf3de32c0) at nsh_mntcmds.c:73
|apache#13 0x08056370 in nsh_command (vtbl=0xf3df3f10, argc=1, argv=0xf3de32c0) at nsh_command.c:1061
|apache#14 0x08053b16 in nsh_execute (vtbl=0xf3df3f10, argc=1, argv=0xf3de32c0, redirfile=0x0, oflags=0) at nsh_parse.c:741
|apache#15 0x08055998 in nsh_parse_command (vtbl=0xf3df3f10, cmdline=0xf3df4378 "df") at nsh_parse.c:2578
|apache#16 0x08055a7b in nsh_parse (vtbl=0xf3df3f10, cmdline=0xf3df4378 "df") at nsh_parse.c:2662
|apache#17 0x0805d691 in nsh_session (pstate=0xf3df3f10, login=1 '\001', argc=1, argv=0xf3de34b0) at nsh_session.c:191
|apache#18 0x0805b542 in nsh_consolemain (argc=1, argv=0xf3de34b0) at nsh_consolemain.c:115
|apache#19 0x0805346c in nsh_main (argc=1, argv=0xf3de34b0) at nsh_main.c:168
|apache#20 0x0805075a in nxtask_startup (entrypt=0x805340a <nsh_main>, argc=1, argv=0xf3de34b0) at sched/task_startup.c:165
|apache#21 0x08049713 in nxtask_start () at task/task_start.c:144
|apache#22 0x00000000 in ?? ()

Change-Id: Ic4c7aff0ea50388a371c525745e817a787dabcca
Signed-off-by: chao.an <[email protected]>
pwnall pushed a commit to pwnall/nuttx that referenced this pull request Oct 23, 2024
VELAPLATFO-1585

==1598322==ERROR: AddressSanitizer: heap-use-after-free on address 0xf514f8a8 at pc 0x58ac3898 bp 0xd0b4d488 sp 0xd0b4d478
READ of size 4 at 0xf514f8a8 thread T0
    #0 0x58ac3897 in rpmsg_socket_pollnotify rpmsg/rpmsg_sockif.c:211
    apache#1 0x58ac512f in rpmsg_socket_ept_cb rpmsg/rpmsg_sockif.c:312
    apache#2 0x5787881c in rpmsg_virtio_rx_callback open-amp/lib/rpmsg/rpmsg_virtio.c:331
    apache#3 0x57886a67 in virtqueue_notification open-amp/lib/virtio/virtqueue.c:623
    apache#4 0x5786fb89 in rproc_virtio_notified open-amp/lib/remoteproc/remoteproc_virtio.c:340
    apache#5 0x5786bde3 in remoteproc_get_notification open-amp/lib/remoteproc/remoteproc.c:985
    apache#6 0x57755a50 in rptun_worker rptun/rptun.c:303
    apache#7 0x57755e51 in rptun_thread rptun/rptun.c:352
    apache#8 0x57730d4a in nxtask_start task/task_start.c:128
    apache#9 0xdeadbeee  (/memfd:pulseaudio (deleted)+0x15dbeee)

Change-Id: I29fc2ab82376ff6cd421fd383cdaa8ac85216364
Signed-off-by: ligd <[email protected]>
xiaoxiang781216 pushed a commit that referenced this pull request Oct 29, 2024
current sizeof(struct sockaddr_in) is 66

arp/arp_table.c:241:28: runtime error: member access within misaligned address 0xe5f134e6 for type 'struct sockaddr_in', which requires 4 byte alignment
0xe5f134e6: note: pointer points here
 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00
             ^
    #0 0x543287c1 in arp_get_arpreq arp/arp_table.c:241
    #1 0x5432a11f in arp_snapshot arp/arp_table.c:574
    #2 0x5435f0be in netlink_fill_arptable netlink/netlink_route.c:547
    #3 0x5435ffca in netlink_get_neighbor netlink/netlink_route.c:715
    #4 0x54360116 in netlink_get_neighborlist netlink/netlink_route.c:743
    #5 0x54363b20 in netlink_route_sendto netlink/netlink_route.c:1382
    #6 0x542ef1b1 in netlink_sendmsg netlink/netlink_sockif.c:625
    #7 0x542be94d in psock_sendmsg socket/sendmsg.c:96
    #8 0x542bc94b in psock_sendto socket/sendto.c:134
    #9 0x542bcb28 in sendto socket/sendto.c:247
    #10 0x542bc5ea in send socket/send.c:163
    #11 0x542aa715 in netlib_get_arptable /home/mi/gaofengzhi/code/dev1025/apps/netutils/netlib/netlib_getarptab.c:152
    #12 0x54279109 in cmd_arp /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_netcmds.c:1197
    #13 0x54257faf in nsh_command /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_command.c:1263
    #14 0x54231982 in nsh_execute /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_parse.c:718
    #15 0x5423da42 in nsh_parse_command /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_parse.c:2619
    #16 0x5423e12a in nsh_parse /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_parse.c:2706
    #17 0x5424088f in nsh_session /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_session.c:245
    #18 0x5422efc9 in nsh_consolemain /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_consolemain.c:75
    #19 0x5419e89f in nsh_main /home/mi/gaofengzhi/code/dev1025/apps/system/nsh/nsh_main.c:74
    #20 0x54067ee1 in nxtask_startup sched/task_startup.c:70
    #21 0x53f366c6 in nxtask_start task/task_start.c:116
    #22 0x5409e1a4 in pre_start sim/sim_initialstate.c:52

Signed-off-by: zhanghongyu <[email protected]>
TakuyaMiyasita referenced this pull request Oct 31, 2024
Summary:
  1.Modified the i_crefs from int16_t to atomic_int
  2.Modified the i_crefs add, delete, read, and initialize interfaces to atomic operations
The purpose of this change is to avoid deadlock in cross-core scenarios, where A Core blocks B Core’s request for a write operation to A Core when A Core requests a read operation to B Core.

Signed-off-by: chenrun1 <[email protected]>
JaeheeKwon pushed a commit to JaeheeKwon/nuttx that referenced this pull request Nov 28, 2024
current sizeof(struct sockaddr_in) is 66

arp/arp_table.c:241:28: runtime error: member access within misaligned address 0xe5f134e6 for type 'struct sockaddr_in', which requires 4 byte alignment
0xe5f134e6: note: pointer points here
 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00
             ^
    #0 0x543287c1 in arp_get_arpreq arp/arp_table.c:241
    apache#1 0x5432a11f in arp_snapshot arp/arp_table.c:574
    apache#2 0x5435f0be in netlink_fill_arptable netlink/netlink_route.c:547
    apache#3 0x5435ffca in netlink_get_neighbor netlink/netlink_route.c:715
    apache#4 0x54360116 in netlink_get_neighborlist netlink/netlink_route.c:743
    apache#5 0x54363b20 in netlink_route_sendto netlink/netlink_route.c:1382
    apache#6 0x542ef1b1 in netlink_sendmsg netlink/netlink_sockif.c:625
    apache#7 0x542be94d in psock_sendmsg socket/sendmsg.c:96
    apache#8 0x542bc94b in psock_sendto socket/sendto.c:134
    apache#9 0x542bcb28 in sendto socket/sendto.c:247
    apache#10 0x542bc5ea in send socket/send.c:163
    apache#11 0x542aa715 in netlib_get_arptable /home/mi/gaofengzhi/code/dev1025/apps/netutils/netlib/netlib_getarptab.c:152
    apache#12 0x54279109 in cmd_arp /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_netcmds.c:1197
    apache#13 0x54257faf in nsh_command /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_command.c:1263
    apache#14 0x54231982 in nsh_execute /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_parse.c:718
    apache#15 0x5423da42 in nsh_parse_command /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_parse.c:2619
    apache#16 0x5423e12a in nsh_parse /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_parse.c:2706
    apache#17 0x5424088f in nsh_session /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_session.c:245
    apache#18 0x5422efc9 in nsh_consolemain /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_consolemain.c:75
    apache#19 0x5419e89f in nsh_main /home/mi/gaofengzhi/code/dev1025/apps/system/nsh/nsh_main.c:74
    apache#20 0x54067ee1 in nxtask_startup sched/task_startup.c:70
    apache#21 0x53f366c6 in nxtask_start task/task_start.c:116
    apache#22 0x5409e1a4 in pre_start sim/sim_initialstate.c:52

Signed-off-by: zhanghongyu <[email protected]>
xiaoxiang781216 pushed a commit that referenced this pull request Dec 17, 2024
test code hello_main

int main(int argc, FAR char *argv[])
{
  uint32_t *p = 0xdeedbeff;
  *p = 0xffffff;

  printf("%p\n %x\n", p, *p);
  return 0;
}

qemu mps3-an547 hello_main :
Triggering an exception, and gdb backtrace is:

before:
(gdb) bt
/#0  0x0001168a in systick_getstatus (lower_=0x100010c <g_systick_lower>, status=0x1000a30 <g_intstackalloc+1600>)
    at /home/ajh/work/vela_system/nuttx/arch/arm/src/armv8-m/arm_systick.c:142
/#1  0x000122f4 in current_usec () at /home/ajh/work/vela_system/nuttx/drivers/timers/arch_timer.c:105
/#2  0x0001234c in udelay_accurate (microseconds=250000) at /home/ajh/work/vela_system/nuttx/drivers/timers/arch_timer.c:115
/#3  0x000124bc in up_udelay (microseconds=250000) at /home/ajh/work/vela_system/nuttx/drivers/timers/arch_timer.c:463
/#4  0x0001249e in up_mdelay (milliseconds=250) at /home/ajh/work/vela_system/nuttx/drivers/timers/arch_timer.c:446
/#5  0x0000920c in reset_board () at /home/ajh/work/vela_system/nuttx/sched/misc/assert.c:830
/#6  0x0000937c in _assert (filename=0x393f8 "/arch/arm/src/armv8-m/arm_busfault.c", linenum=113, msg=0x393f0 "panic", regs=0x1008500)
    at /home/ajh/work/vela_system/nuttx/sched/misc/assert.c:940
/#7  0x00000e2c in arm_busfault (irq=3, context=0x1008500, arg=0x0 <up_ndelay>) at /home/ajh/work/vela_system/nuttx/arch/arm/src/armv8-m/arm_busfault.c:113
/#8  0x000012d2 in arm_hardfault (irq=3, context=0x1008500, arg=0x0 <up_ndelay>)
    at /home/ajh/work/vela_system/nuttx/arch/arm/src/armv8-m/arm_hardfault.c:142
/#9  0x00008b20 in irq_dispatch (irq=3, context=0x1008500) at /home/ajh/work/vela_system/nuttx/sched/irq/irq_dispatch.c:145
/#10 0x0000041a in arm_doirq (irq=3, regs=0x1008500) at /home/ajh/work/vela_system/nuttx/arch/arm/src/armv8-m/arm_doirq.c:103
/#11 0x0000034e in exception_common () at /home/ajh/work/vela_system/nuttx/arch/arm/src/armv8-m/arm_exception.S:224

after:
(gdb) bt
/#0  systick_is_running () at /home/ajh/work/vela_system/nuttx/arch/arm/src/armv8-m/arm_systick.c:106
/#1  0x000125c0 in systick_getstatus (lower_=0x1000114 <g_systick_lower>, status=0x1007a20)
    at /home/ajh/work/vela_system/nuttx/arch/arm/src/armv8-m/arm_systick.c:141
/#2  0x0001323c in current_usec () at /home/ajh/work/vela_system/nuttx/drivers/timers/arch_timer.c:105
/#3  0x00013294 in udelay_accurate (microseconds=250000) at /home/ajh/work/vela_system/nuttx/drivers/timers/arch_timer.c:115
/#4  0x00013404 in up_udelay (microseconds=250000) at /home/ajh/work/vela_system/nuttx/drivers/timers/arch_timer.c:463
/#5  0x000133e6 in up_mdelay (milliseconds=250) at /home/ajh/work/vela_system/nuttx/drivers/timers/arch_timer.c:446
/#6  0x00008c5c in reset_board () at /home/ajh/work/vela_system/nuttx/sched/misc/assert.c:816
/#7  0x00008e88 in _assert (filename=0x39408 "/arch/arm/src/armv8-m/arm_busfault.c", linenum=113, msg=0x39400 "panic", regs=0x1007cf0)
    at /home/ajh/work/vela_system/nuttx/sched/misc/assert.c:915
/#8  0x00000ce4 in arm_busfault (irq=3, context=0x1007cf0, arg=0x0 <up_ndelay>)
    at /home/ajh/work/vela_system/nuttx/arch/arm/src/armv8-m/arm_busfault.c:113
/#9  0x0000118a in arm_hardfault (irq=3, context=0x1007cf0, arg=0x0 <up_ndelay>)
    at /home/ajh/work/vela_system/nuttx/arch/arm/src/armv8-m/arm_hardfault.c:142
/#10 0x000086cc in irq_dispatch (irq=3, context=0x1007cf0) at /home/ajh/work/vela_system/nuttx/sched/irq/irq_dispatch.c:145
/#11 0x0000041e in arm_doirq (irq=3, regs=0x1007cf0) at /home/ajh/work/vela_system/nuttx/arch/arm/src/armv8-m/arm_doirq.c:99
/#12 0x00000360 in exception_common () at /home/ajh/work/vela_system/nuttx/arch/arm/src/armv8-m/arm_exception.S:230
/#13 0x00027a8c in hello_main (argc=1, argv=0x1006e20) at /home/ajh/work/vela_system/apps/examples/hello/hello_main.c:39
/#14 0x00014968 in nxtask_startup (entrypt=0x27a7d <hello_main>, argc=1, argv=0x1006e20)
    at /home/ajh/work/vela_system/nuttx/libs/libc/sched/task_startup.c:72
/#15 0x0000f450 in nxtask_start () at /home/ajh/work/vela_system/nuttx/sched/task/task_start.c:116
/#16 0x00000000 in ?? ()
(gdb)

qemu armv7a nsh, hello_main:

before:
(gdb) bt
/#0  udelay_coarse (microseconds=156000) at /home/ajh/work/vela_system/nuttx/drivers/timers/arch_alarm.c:67
/#1  up_ndelay (nanoseconds=nanoseconds@entry=250000000) at /home/ajh/work/vela_system/nuttx/drivers/timers/arch_alarm.c:431
/#2  0x0060c630 in up_udelay (microseconds=microseconds@entry=250000) at /home/ajh/work/vela_system/nuttx/drivers/timers/arch_alarm.c:416
/#3  0x0060c644 in up_mdelay (milliseconds=milliseconds@entry=250) at /home/ajh/work/vela_system/nuttx/drivers/timers/arch_alarm.c:401
/#4  0x006056bc in reset_board () at /home/ajh/work/vela_system/nuttx/sched/misc/assert.c:816
/#5  _assert (filename=filename@entry=0x63047f "/arch/arm/src/armv7-a/arm_dataabort.c", linenum=linenum@entry=157, msg=msg@entry=0x62f56d "panic",
    regs=<optimized out>, regs@entry=0x4020af10) at /home/ajh/work/vela_system/nuttx/sched/misc/assert.c:915
/#6  0x0060bd74 in arm_dataabort (regs=0x4020af10, dfar=<optimized out>, dfsr=<optimized out>)
    at /home/ajh/work/vela_system/nuttx/arch/arm/src/armv7-a/arm_dataabort.c:157
/#7  0x0060bc04 in arm_vectordata () at /home/ajh/work/vela_system/nuttx/arch/arm/src/armv7-a/arm_vectors.S:438
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)

after:
(gdb) bt
/#0  udelay_coarse (microseconds=192000) at /home/ajh/work/vela_system/nuttx/drivers/timers/arch_alarm.c:67
/#1  up_ndelay (nanoseconds=nanoseconds@entry=250000000) at /home/ajh/work/vela_system/nuttx/drivers/timers/arch_alarm.c:431
/#2  0x0060c650 in up_udelay (microseconds=microseconds@entry=250000) at /home/ajh/work/vela_system/nuttx/drivers/timers/arch_alarm.c:416
/#3  0x0060c664 in up_mdelay (milliseconds=milliseconds@entry=250) at /home/ajh/work/vela_system/nuttx/drivers/timers/arch_alarm.c:401
/#4  0x006056bc in reset_board () at /home/ajh/work/vela_system/nuttx/sched/misc/assert.c:816
/#5  _assert (filename=filename@entry=0x63047f "/arch/arm/src/armv7-a/arm_dataabort.c", linenum=linenum@entry=157, msg=msg@entry=0x62f56d "panic",
    regs=<optimized out>, regs@entry=0x4020af10) at /home/ajh/work/vela_system/nuttx/sched/misc/assert.c:915
/#6  0x0060bd94 in arm_dataabort (regs=0x4020af10, dfar=<optimized out>, dfsr=<optimized out>)
    at /home/ajh/work/vela_system/nuttx/arch/arm/src/armv7-a/arm_dataabort.c:157
/#7  0x0060bc08 in arm_vectordata () at /home/ajh/work/vela_system/nuttx/arch/arm/src/armv7-a/arm_vectors.S:453
/#8  0x00620cd4 in hello_main (argc=4999, argv=0x0) at /home/ajh/work/vela_system/apps/examples/hello/hello_main.c:41
/#9  0x0060d320 in nxtask_startup (entrypt=0x620cc4 <hello_main>, argc=1, argv=0x4020a088)
    at /home/ajh/work/vela_system/nuttx/libs/libc/sched/task_startup.c:72
/#10 0x00609b50 in nxtask_start () at /home/ajh/work/vela_system/nuttx/sched/task/task_start.c:116
/#11 0x00000000 in ?? ()

qemu risc-v nsh

before:

(gdb) bt
/#0  udelay_coarse (microseconds=228000, microseconds@entry=891896832) at timers/arch_alarm.c:67
/#1  up_ndelay (nanoseconds=nanoseconds@entry=250000000) at timers/arch_alarm.c:431
/#2  0x8000397e in up_udelay (microseconds=microseconds@entry=250000) at timers/arch_alarm.c:416
/#3  0x80003988 in up_mdelay (milliseconds=milliseconds@entry=250) at timers/arch_alarm.c:401
/#4  0x80011f1c in reset_board () at misc/assert.c:813
/#5  0x80011f7a in _assert (filename=filename@entry=0x0, linenum=linenum@entry=0, msg=msg@entry=0x8002114c "panic", regs=<optimized out>,
    regs@entry=0x80030704) at misc/assert.c:915
/#6  0x80006ad6 in riscv_exception (mcause=<optimized out>, regs=0x80030704, args=<optimized out>) at common/riscv_exception.c:129
/#7  0x80000d9e in riscv_doirq (irq=7, regs=<optimized out>) at common/riscv_doirq.c:99
/#8  0x80000164 in exception_common () at common/riscv_exception_common.S:210
Backtrace stopped: frame did not save the PC
(gdb)

after

(gdb) bt
/#0  0x80003922 in udelay_coarse (microseconds=90000, microseconds@entry=891896832) at timers/arch_alarm.c:67
/#1  up_ndelay (nanoseconds=nanoseconds@entry=250000000) at timers/arch_alarm.c:431
/#2  0x8000397e in up_udelay (microseconds=microseconds@entry=250000) at timers/arch_alarm.c:416
/#3  0x80003988 in up_mdelay (milliseconds=milliseconds@entry=250) at timers/arch_alarm.c:401
/#4  0x80011f2a in reset_board () at misc/assert.c:816
/#5  0x80011f7a in _assert (filename=filename@entry=0x0, linenum=linenum@entry=0, msg=msg@entry=0x8002114c "panic", regs=<optimized out>,
    regs@entry=0x80030704) at misc/assert.c:915
/#6  0x80006ad6 in riscv_exception (mcause=<optimized out>, regs=0x80030704, args=<optimized out>) at common/riscv_exception.c:129
/#7  0x80000d9e in riscv_doirq (irq=7, regs=<optimized out>) at common/riscv_doirq.c:99
/#8  0x80000166 in exception_common () at common/riscv_exception_common.S:215
/#9  0x8001792a in hello_main (argc=<optimized out>, argv=<optimized out>) at hello_main.c:41
/#10 0x80004b52 in nxtask_startup (entrypt=0x80030704, argc=1, argv=0x800300e8) at sched/task_startup.c:72
/#11 0x80001e72 in nxtask_start () at task/task_start.c:116
/#12 0x00000000 in ?? ()
Backtrace stopped: frame did not save the PC
(gdb)

Signed-off-by: anjiahao <[email protected]>
xiaoxiang781216 pushed a commit that referenced this pull request Dec 25, 2024
CID 1578530: (#1 of 1): INTEGER_OVERFLOW

Signed-off-by: yangsen5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants