]> git.gag.com Git - fw/openocd/commit
semihosting: use open mode flags from GDB, not from sys/stat.h
authorPavel Kirienko <pavel.kirienko@gmail.com>
Sun, 9 Jan 2022 21:18:13 +0000 (23:18 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 29 Jan 2022 18:25:21 +0000 (18:25 +0000)
commitdbbac5f11d662ab0827a997aa5d173fd62c51708
tree762d90cbe7fb62f300b715efc52cd28f2f33109e
parent6541233aa78d40200092920ec4a72e3917ae3b6d
semihosting: use open mode flags from GDB, not from sys/stat.h

Values defined in sys/stat.h are not guaranteed to match
the constants defined by the GDB remote protocol, which are defined in
https://sourceware.org/gdb/onlinedocs/gdb/Open-Flags.html#Open-Flags.
On my local system (Manjaro 21.2.1 x86_64), for example, O_TRUNC is
defined as 0x40, whereas GDB requires it to be 0x400,
causing all "w" file open modes to misbehave.

This patch has been tested with STM32F446.

Change-Id: Ifb2c740fd689e71d6f1a4bde1edaecd76fdca910
Signed-off-by: Pavel Kirienko <pavel.kirienko@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6804
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/target/semihosting_common.c