You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2020/04/20 15:02:41 UTC

[GitHub] [mynewt-core] mlaz commented on a change in pull request #2259: ARM semihosting console on pinetime

mlaz commented on a change in pull request #2259:
URL: https://github.com/apache/mynewt-core/pull/2259#discussion_r409181015



##########
File path: sys/console/full/src/semihosting_console.c
##########
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2020 Casper Meijn <ca...@meijn.net>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "os/mynewt.h"
+
+#if MYNEWT_VAL(CONSOLE_SEMIHOSTING)
+
+#include "semihosting/mbed_semihost_api.h"
+#include <unistd.h>
+#include "console_priv.h"
+
+static unsigned char semihosting_tx_buffer[MYNEWT_VAL(CONSOLE_SEMIHOSTING_TX_BUF_SIZE)];
+static unsigned char *semihosting_tx_buffer_pos = semihosting_tx_buffer;
+
+static void
+semihosting_console_flush(void)
+{
+    unsigned int size = semihosting_tx_buffer_pos - semihosting_tx_buffer;
+    semihost_write(STDOUT_FILENO, semihosting_tx_buffer, size, 0);
+    semihosting_tx_buffer_pos = semihosting_tx_buffer;
+}
+
+static void
+semihosting_console_flush_event(struct os_event *ev)
+{
+    semihosting_console_flush();
+}
+
+static void
+semihosting_console_write(unsigned char c)
+{
+    *semihosting_tx_buffer_pos = c;
+    semihosting_tx_buffer_pos++;
+    if (semihosting_tx_buffer_pos > semihosting_tx_buffer + sizeof(semihosting_tx_buffer)) {

Review comment:
       This line is longer than 80 col.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org