aboutsummaryrefslogtreecommitdiff
path: root/targets/corstone-300/retarget.c
diff options
context:
space:
mode:
authorKristofer Jonsson <kristofer.jonsson@arm.com>2021-01-21 17:39:03 +0100
committerPer Åstrand <per.astrand@arm.com>2021-02-02 17:26:36 +0100
commitf62c3d756917295146d415fcba7b5208c13874f7 (patch)
treea8948a458d2db6bf2daa78b1e7dc411f2cff51d4 /targets/corstone-300/retarget.c
parent6663630bb3feea222fd38278a962297c08d0b320 (diff)
downloadethos-u-core-platform-f62c3d756917295146d415fcba7b5208c13874f7.tar.gz
Build system refactoring
The source tree is configured for a specific target as defined in the targets directory. The common target components are defined in targets/common. Targets for real platform should include this directory to get the default target libraries setup. Change-Id: I7fced4bfacec97432cbbd4125bd5b4cdd21122e3
Diffstat (limited to 'targets/corstone-300/retarget.c')
-rw-r--r--targets/corstone-300/retarget.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/targets/corstone-300/retarget.c b/targets/corstone-300/retarget.c
index 1598427..d53431f 100644
--- a/targets/corstone-300/retarget.c
+++ b/targets/corstone-300/retarget.c
@@ -183,7 +183,28 @@ char *RETARGET(_command_string)(char *cmd, int len) {
}
void RETARGET(_exit)(int return_code) {
- exit(return_code);
+ char exit_code_buffer[64] = {0};
+ const char *p = exit_code_buffer;
+
+ /* Print out the exit code on the uart so any reader know how we exit. */
+ /* By appending 0x04, ASCII for end-of-transmission the FVP model exits,
+ * if the configuration parameter shutdown_on_eot on the uart is enabled.
+ * For some versions of FVP, the shutdown_on_eot is broken, but the same
+ * behaviour can be created by passing specifying a shutdown_tag= for the
+ * uart when starting the model so that is added last as well.
+ */
+
+ snprintf(exit_code_buffer, sizeof(exit_code_buffer),
+ "Application exit code: %d.\n" // Let the readers know how we exit
+ "\04\n" // end-of-transmission
+ "EXITTHESIM\n", // shutdown_tag
+ return_code);
+
+ while (*p != '\0') {
+ uart_putc(*p++);
+ }
+
+ while (1) {}
}
int system(const char *cmd) {
@@ -231,12 +252,6 @@ int rename(const char *oldn, const char *newn) {
return 0;
}
-void exit(int code) {
- uart_putc((char)0x4);
- uart_putc((char)code);
- while (1) {}
-}
-
int fputc(int ch, FILE *f) {
(void)(f);
return uart_putc(ch);