Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
70a6791b
Commit
70a6791b
authored
Aug 09, 2024
by
Damien George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shared/runtime/semihosting_arm: Add mp_semihosting_rx_chars.
Signed-off-by:
Damien George
<
damien@micropython.org
>
parent
9f9c283e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
shared/runtime/semihosting_arm.c
shared/runtime/semihosting_arm.c
+15
-0
shared/runtime/semihosting_arm.h
shared/runtime/semihosting_arm.h
+3
-0
No files found.
shared/runtime/semihosting_arm.c
View file @
70a6791b
...
...
@@ -34,6 +34,7 @@
#define SYS_OPEN 0x01
#define SYS_WRITEC 0x03
#define SYS_WRITE 0x05
#define SYS_READ 0x06
#define SYS_READC 0x07
// Constants:
...
...
@@ -91,6 +92,20 @@ int mp_semihosting_rx_char() {
return
mp_semihosting_call
(
SYS_READC
,
NULL
);
}
// Returns 0 on success.
int
mp_semihosting_rx_chars
(
char
*
str
,
size_t
len
)
{
struct
{
uint32_t
fd
;
const
char
*
str
;
uint32_t
len
;
}
args
=
{
.
fd
=
mp_semihosting_stdout
,
.
str
=
str
,
.
len
=
len
,
};
return
mp_semihosting_call
(
SYS_READ
,
&
args
);
}
static
void
mp_semihosting_tx_char
(
char
c
)
{
mp_semihosting_call
(
SYS_WRITEC
,
&
c
);
}
...
...
shared/runtime/semihosting_arm.h
View file @
70a6791b
...
...
@@ -38,6 +38,8 @@ Then make sure the debugger is attached and enables semihosting. In OpenOCD thi
done with ARM semihosting enable followed by reset. The terminal will need further
configuration to work with MicroPython (bash: stty raw -echo).
If mp_semihosting_rx_char() doesn't work then try mp_semihosting_rx_chars(str, 1).
*/
#include <stddef.h>
...
...
@@ -45,6 +47,7 @@ configuration to work with MicroPython (bash: stty raw -echo).
void
mp_semihosting_init
();
int
mp_semihosting_rx_char
();
int
mp_semihosting_rx_chars
(
char
*
str
,
size_t
len
);
uint32_t
mp_semihosting_tx_strn
(
const
char
*
str
,
size_t
len
);
uint32_t
mp_semihosting_tx_strn_cooked
(
const
char
*
str
,
size_t
len
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment