Skip to content

Conversation

jcarrano
Copy link

Contribution description

I managed to directly override the symbols by using UNDEF. That they are overrided can be verified by objdump-ing the cpp_tests binary.

400d0020 <__cxa_guard_acquire>:
400d0020:	004136        	entry	a1, 32
400d0023:	000232        	l8ui	a3, a2, 0
400d0026:	00a082        	movi	a8, 0
400d0029:	259387        	bne	a3, a8, 400d0052 <__cxa_guard_acquire+0x32>
400d002c:	b06b65        	call8	400806e4 <irq_disable>
400d002f:	010282        	l8ui	a8, a2, 1
400d0032:	203aa0        	or	a3, a10, a10
400d0035:	00d816        	beqz	a8, 400d0046 <__cxa_guard_acquire+0x26>
400d0038:	b06c65        	call8	40080700 <irq_restore>
400d003b:	fff7c1        	l32r	a12, 400d0018 <_flash_cache_start>
400d003e:	fff7b1        	l32r	a11, 400d001c <_flash_cache_start+0x4>
400d0041:	1a0c      	movi.n	a10, 1
400d0043:	b22ee5        	call8	40082330 <log_write_tagged>
400d0046:	180c      	movi.n	a8, 1
400d0048:	014282        	s8i	a8, a2, 1
400d004b:	03ad      	mov.n	a10, a3
400d004d:	b06b25        	call8	40080700 <irq_restore>
400d0050:	180c      	movi.n	a8, 1
400d0052:	082d      	mov.n	a2, a8
400d0054:	f01d      	retw.n
	...

Directly override the symbols by using UNDEF. That they are overrided can be
verified by objdump-ing the cpp_tests binary.
Copy link
Owner

@gschorcht gschorcht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great.

@gschorcht gschorcht merged commit 01100f2 into gschorcht:cpu/esp32/fix_static_object_init Aug 23, 2019
@gschorcht
Copy link
Owner

Thanks a lot for the fix.

gschorcht pushed a commit that referenced this pull request Sep 4, 2019
The test randomly fails on `native` due to timers being not accurate but
it cannot be otherwise. So better disable it than raising fake errors.

    main(): This is RIOT! (Version: buildtest)
    Testing generic evtimer
    This should list 2 items
    ev #1 offset=1000
    ev #2 offset=500
    This should list 4 items
    ev #1 offset=659
    ev #2 offset=341
    ev #3 offset=500
    ev #4 offset=2454
    Are the reception times of all 4 msgs close to the supposed values?
    At    662 ms received msg 0: "#2 supposed to be 659"
    At   1009 ms received msg 1: "#0 supposed to be 1000"
    At   1511 ms received msg 2: "#1 supposed to be 1500"

    Traceback (most recent call last):
      File "/tmp/dwq.0.3125418833043728/ef3af88c4b3615788b164464a437df5c/tests/evtimer_msg/tests/01-run.py", line 33, in <module>
        sys.exit(run(testfunc))
      File "/tmp/dwq.0.3125418833043728/ef3af88c4b3615788b164464a437df5c/dist/pythonlibs/testrunner/__init__.py", line 29, in run
        testfunc(child)
      File "/tmp/dwq.0.3125418833043728/ef3af88c4b3615788b164464a437df5c/tests/evtimer_msg/tests/01-run.py", line 26, in testfunc
        assert(actual in range(expected - ACCEPTED_ERROR, expected + ACCEPTED_ERROR))
    AssertionError
gschorcht pushed a commit that referenced this pull request Jun 22, 2020
When CDC ACM is used as stdio the first thread in the test may have a
different ID than #3. The test code will now look at the printed thread
information (id, prio) as they are created. This avoids the need for a
table with ID/prio.
gschorcht pushed a commit that referenced this pull request Jun 22, 2020
When CDC ACM is used as stdio the first thread in the test may have a
different ID than #3. The test code will now look at the printed thread
information (id, prio) as they are created. This avoids the need for a
table with ID/prio.
gschorcht pushed a commit that referenced this pull request Jun 22, 2020
When CDC ACM is used as stdio the first thread in the test may have a
different ID than #3. The test code will now look at the printed thread
information (id, prio) as they are created. This avoids the need for a
table with ID/prio.
gschorcht pushed a commit that referenced this pull request Jun 22, 2020
When CDC ACM is used as stdio the first thread in the test may have a
different ID than #3.
gschorcht pushed a commit that referenced this pull request Jun 22, 2020
…d IDs

When CDC ACM is used as stdio the first thread in the test may have a
different ID than #3. The test code will now look at the printed thread
information (id, prio) as they are created. This avoids the need for a
table with ID/prio.
gschorcht added a commit that referenced this pull request Jul 26, 2020
This change is a temporary patch to fix the compilation errors with the STM32 MCU implementation of the new low-level GPIO API until PR #3 for micropython is merged. Once this PR is merged, this patch can be dropped.
gschorcht added a commit that referenced this pull request Jul 26, 2020
This change is a temporary patch to fix the compilation errors with the STM32 MCU implementation of the new low-level GPIO API until PR #3 for micropython is merged. Once this PR is merged, this patch can be dropped.
gschorcht added a commit that referenced this pull request Jul 26, 2020
This change is a temporary patch to fix the compilation errors with the STM32 MCU implementation of the new low-level GPIO API until PR #3 for micropython is merged. Once this PR is merged, this patch can be dropped.
gschorcht added a commit that referenced this pull request Jul 26, 2020
This change is a temporary patch to fix the compilation errors with the STM32 MCU implementation of the new low-level GPIO API until PR #3 for micropython is merged. Once this PR is merged, this patch can be dropped.
gschorcht added a commit that referenced this pull request Jul 26, 2020
This change is a temporary patch to fix the compilation errors with the STM32 MCU implementation of the new low-level GPIO API until PR #3 for micropython is merged. Once this PR is merged, this patch can be dropped.
gschorcht added a commit that referenced this pull request Sep 3, 2020
This change is a temporary patch to fix the compilation errors with the STM32 MCU implementation of the new low-level GPIO API until PR #3 for micropython is merged. Once this PR is merged, this patch can be dropped.
gschorcht added a commit that referenced this pull request Sep 3, 2020
This change is a temporary patch to fix the compilation errors with the STM32 MCU implementation of the new low-level GPIO API until PR #3 for micropython is merged. Once this PR is merged, this patch can be dropped.
gschorcht pushed a commit that referenced this pull request Feb 1, 2022
The ENTROPY test always fails on this board

main(): This is RIOT! (Version: buildtest)
mbedtls test

  SHA-224 test #1: passed
  SHA-224 test #2: passed
  SHA-224 test #3: passed
  SHA-256 test #1: passed
  SHA-256 test #2: passed
  SHA-256 test #3: passed

  ENTROPY test: failed
gschorcht pushed a commit that referenced this pull request Feb 17, 2023
19270: drivers/at24cxxx: implement _mtd_at24cxxx_read_page r=benpicco a=HendrikVE

### Contribution description

The function `read_page` was missing which lead to (from a user perspective) undefined behavior on the MTD layer.

### Testing procedure

Any application using MTD in conjunction with a board with an at24cxxx.


19271: core/xfa: disable asan on llvm r=benpicco a=Teufelchen1

### Contribution description
Hi! 🦎

When using llvm and address sanitation, the XFA trip the sanitizer.
This PR attempts to fix this by adding the `no_sanitize` attribute to the XFA macros. Sadly, this attribute is not known by gnu, a guard is hence needed. I'm open for alternatives as I dislike this solution but it is the best I could come up with.

### Testing procedure

Before this patch:

Go to `examples/gnrc_minimal` and run `TOOLCHAIN=llvm make all-asan` and then `make term`.
You should see an error similar to this:
```
==3374719==ERROR: AddressSanitizer: global-buffer-overflow on address 0x080774e0 at pc 0x0804af5e bp 0x0808eb88 sp 0x0808eb78
READ of size 4 at 0x080774e0 thread T0
    #0 0x804af5d in _auto_init_module /RIOT/sys/auto_init/auto_init.c:40
    #1 0x804af5d in auto_init /RIOT/sys/auto_init/auto_init.c:339
    #2 0x804b375 in main_trampoline /RIOT/core/lib/init.c:56
    #3 0xf76bc7b8 in makecontext (/lib32/libc.so.6+0x4a7b8)
...
``` 
After applying this PR, the example can be build and run with llvm or gcc, with or without asan.



Co-authored-by: Hendrik van Essen <hendrik.vanessen@ml-pa.com>
Co-authored-by: Teufelchen1 <bennet.blischke@haw-hamburg.de>
gschorcht pushed a commit that referenced this pull request Mar 7, 2023
18392: drivers/servo: reimplement with high level interface r=benpicco a=maribu

### Contribution description

The previous servo driver didn't provide any benefit over using PWM directly, as users controlled the servo in terms of PWM duty cycles. This changes the interface to provide a high level interface that abstracts the gory PWM details.

In addition, a SAUL layer and auto-initialization is provided.

### Testing procedure

The test application provides access to the servo driver via the `saul` shell command.

```
> saul
2022-08-02 22:12:31,826 # saul
2022-08-02 22:12:31,827 # ID	Class		Name
2022-08-02 22:12:31,830 # #0	ACT_SWITCH	LD1(green)
2022-08-02 22:12:31,832 # #1	ACT_SWITCH	LD2(blue)
2022-08-02 22:12:31,834 # #2	ACT_SWITCH	LD3(red)
2022-08-02 22:12:31,837 # #3	SENSE_BTN	B1(User button)
2022-08-02 22:12:31,838 # #4	ACT_SERVO	servo
> saul write 4 0
2022-08-02 22:12:41,443 # saul write 4 0
2022-08-02 22:12:41,445 # Writing to device #4 - servo
2022-08-02 22:12:41,447 # Data:	             0 
2022-08-02 22:12:41,450 # [servo] setting 0 to 2949 (0 / 255)
2022-08-02 22:12:41,453 # data successfully written to device #4
> saul write 4 256
2022-08-02 22:12:45,343 # saul write 4 256
2022-08-02 22:12:45,346 # Writing to device #4 - servo
2022-08-02 22:12:45,347 # Data:	           256 
2022-08-02 22:12:45,351 # [servo] setting 0 to 6865 (255 / 255)
2022-08-02 22:12:45,354 # data successfully written to device #4
```

Each write resulted in the MG90S servo that I connected to move to the corresponding position.

### Issues/PRs references

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants