From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- .../ARM202U/EXAMPLES/ROM/SPRINTF.C | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/ROM/SPRINTF.C (limited to 'Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/ROM/SPRINTF.C') diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/ROM/SPRINTF.C b/Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/ROM/SPRINTF.C new file mode 100644 index 0000000..6a5d4c9 --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/ROM/SPRINTF.C @@ -0,0 +1,31 @@ +#include + +/* We use the following Debug Monitor SWIs to write things out + * in this example + */ +extern __swi(2) Write0(char *s); /* Write a string */ + +/* The following symbols are defined by the linker and define + * various memory regions which may need to be copied or initialised + */ +extern char Image$$RO$$Base[]; +extern char Image$$RO$$Limit[]; +extern char Image$$RW$$Base[]; + +/* We define some more meaningful names here */ +#define rom_code_base Image$$RO$$Base +#define rom_data_base Image$$RO$$Limit +#define ram_data_base Image$$RW$$Base + +void C_Entry(void) +{ + char s[80]; + + if (rom_data_base == ram_data_base) { + Write0("Warning: Image has been linked as an application. To link as a ROM image\r\n"); + Write0(" link with the options -RO -RW \r\n"); + } + + sprintf(s, "ROM is at address %p, RAM is at address %p\n", rom_code_base, ram_data_base); + Write0(s); +} -- cgit v1.2.3