DMCP_SDK Hello World

This is where developers can exchange ideas and ask questions relevant to the DM42 firmware.

Please note that Swiss Micros staff are unable to provide answers here as a general rule. This is intended as a community-driven forum.
User avatar
ijabbott
Posts: 253
Joined: Fri Dec 15, 2017 2:34 pm
Location: GB-MAN

Re: DMCP_SDK Hello World

Post by ijabbott »

Vitasam wrote:
Thu Jun 14, 2018 10:56 pm
ijabbott wrote:
Thu Jun 14, 2018 10:38 pm
What if you add -std=c99 or -std=c11?
But what is a policy of DM42 SDK - are we C99 compliant?

With following options:

Code: Select all

CFLAGS += -std=c99
CFLAGS += -pedantic-errors

Code: Select all

DMCP_SDK$ make
arm-none-eabi-gcc -c -mthumb -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -D__weak="__attribute__((weak))" -D__packed="__attribute__((__packed__))" -Idmcp -Isrc   -Wall -fdata-sections -ffunction-sections -Wno-misleading-indentation -std=c99 -pedantic-errors -O2 -g  -MD -MP -MF .dep/pgm_syscalls.o.d -Wa,-a,-ad,-alms=build/pgm_syscalls.lst dmcp/sys/pgm_syscalls.c -o build/pgm_syscalls.o
In file included from dmcp/sys/pgm_syscalls.c:44:0:
dmcp/dmcp.h:474:14: error: redefinition of typedef 'void_fn_t' [-Wpedantic]
 typedef void void_fn_t();
              ^
dmcp/dmcp.h:285:14: note: previous declaration of 'void_fn_t' was here
 typedef void void_fn_t();
              ^
dmcp/sys/pgm_syscalls.c:54:2: error: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
  (void*)Program_Entry,  // void * pgm_entry;
  ^
dmcp/sys/pgm_syscalls.c: In function 'free':
dmcp/sys/pgm_syscalls.c:113:2: error: implicit declaration of function 'typeof' [-Wimplicit-function-declaration]
  __sysfn_free(ptr);
  ^
In file included from dmcp/dmcp.h:841:0,
                 from dmcp/sys/pgm_syscalls.c:44:
dmcp/lft_ifc.h:38:38: error: expected expression before ')' token
 #define __sysfn_free (*(typeof(free)*)(LIBRARY_FN_BASE+4))
                                      ^
dmcp/sys/pgm_syscalls.c:113:2: note: in expansion of macro '__sysfn_free'
  __sysfn_free(ptr);
  ^
dmcp/sys/pgm_syscalls.c: In function 'malloc':
dmcp/lft_ifc.h:37:42: error: expected expression before ')' token
 #define __sysfn_malloc (*(typeof(malloc)*)(LIBRARY_FN_BASE+0))
                                          ^
dmcp/sys/pgm_syscalls.c:118:9: note: in expansion of macro '__sysfn_malloc'
  return __sysfn_malloc(size);
         ^
dmcp/sys/pgm_syscalls.c: In function 'calloc':
dmcp/lft_ifc.h:39:42: error: expected expression before ')' token
 #define __sysfn_calloc (*(typeof(calloc)*)(LIBRARY_FN_BASE+8))
                                          ^
dmcp/sys/pgm_syscalls.c:123:9: note: in expansion of macro '__sysfn_calloc'
  return __sysfn_calloc(count, nbytes);
         ^
dmcp/sys/pgm_syscalls.c: In function 'realloc':
dmcp/lft_ifc.h:40:44: error: expected expression before ')' token
 #define __sysfn_realloc (*(typeof(realloc)*)(LIBRARY_FN_BASE+12))
                                            ^
dmcp/sys/pgm_syscalls.c:127:9: note: in expansion of macro '__sysfn_realloc'
  return __sysfn_realloc(ptr, size);
         ^
dmcp/sys/pgm_syscalls.c: In function 'post_main':
dmcp/lft_ifc.h:105:52: error: expected expression before ')' token
 #define set_reset_magic (*(typeof(set_reset_magic)*)(LIBRARY_FN_BASE+272))
                                                    ^
dmcp/sys/pgm_syscalls.c:151:2: note: in expansion of macro 'set_reset_magic'
  set_reset_magic(RUN_DMCP_MAGIC);
  ^
dmcp/lft_ifc.h:173:40: error: expected expression before ')' token
 #define sys_reset (*(typeof(sys_reset)*)(LIBRARY_FN_BASE+544))
                                        ^
dmcp/sys/pgm_syscalls.c:152:2: note: in expansion of macro 'sys_reset'
  sys_reset();
  ^
/usr/include/newlib/stdlib.h: In function 'malloc':
dmcp/sys/pgm_syscalls.c:119:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/usr/include/newlib/stdlib.h: In function 'calloc':
dmcp/sys/pgm_syscalls.c:124:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/usr/include/newlib/stdlib.h: In function 'realloc':
dmcp/sys/pgm_syscalls.c:128:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
dmcp/sys/pgm_syscalls.c: At top level:
cc1: warning: unrecognized command line option "-Wno-misleading-indentation"
Makefile:132: recipe for target 'build/pgm_syscalls.o' failed
make: *** [build/pgm_syscalls.o] Error 1
Some of those could be fixed, but avoiding the typeof keyword (a GCC extension) would make the dmcp/lft_ifc.h header file a lot uglier than it is already.

Also, the C++ sources make use of variable length arrays (VLAs) which are not standard C++, so that would have to be worked around somehow. Not sure it's worth it.

However, using -pedantic is useful for spotting some places that could easily be made more standard.

Setting CFLAGS += -std=c99 in the Makefile currently makes that end up in CXXFLAGS too, so it would need a bit of Makefile hacking to separate the "C only" flags from the "C and C++" flags.
Vitasam

Re: DMCP_SDK Hello World

Post by Vitasam »

Hello,
is it possible to use smaller (and, preferably monospace) font? Having trouble to fit Super Star-Trek status screen there :)
Attachments
startrek.png
startrek.png (2.25 KiB) Viewed 8866 times
Vitasam

How to set monospace font?

Post by Vitasam »

Hello,
I've managed to reduce the font size, now status-screen of StarTrek game fits to the screen.

Question: how to select a monospace font, if any?
Attachments
startrek_2.png
startrek_2.png (2.28 KiB) Viewed 8819 times
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: DMCP_SDK Hello World

Post by Walter »

Dunno about the spelling at stardate 4900, but nowadays torpedos are torpedos (don't take this personally: even American presidents have difficulties with this trailing syllable in plural ;)).
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
Vitasam

Super StarTrek at DM42

Post by Vitasam »

Walter wrote:
Wed Oct 03, 2018 10:11 pm
Dunno about the spelling at stardate 4900, but nowadays torpedos are torpedos (don't take this personally: even American presidents have difficulties with this trailing syllable in plural ;)).
:D Good to know! But, perhaps it is just a tribute to the legendary game, I just copy/pasted status-screen from Github repository.

Nevertheless, without monospace font that screen looks depressing.
User avatar
ijabbott
Posts: 253
Joined: Fri Dec 15, 2017 2:34 pm
Location: GB-MAN

Re: DMCP_SDK Hello World

Post by ijabbott »

Walter wrote:
Wed Oct 03, 2018 10:11 pm
Dunno about the spelling at stardate 4900, but nowadays torpedos are torpedos (don't take this personally: even American presidents have difficulties with this trailing syllable in plural ;)).
I'm pretty sure torpedoes is correct.
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: DMCP_SDK Hello World

Post by Walter »

ijabbott wrote:
Wed Oct 03, 2018 11:26 pm
I'm pretty sure torpedoes is correct.
I stand corrected. It just looks strange to me. :?
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
keithdalby
Posts: 564
Joined: Mon Apr 24, 2017 8:38 pm

Re: DMCP_SDK Hello World

Post by keithdalby »

Walter wrote:
Thu Oct 04, 2018 4:28 am
It just looks strange to me. :?
Don't take it personally: even American presidents have difficulties with this.
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: DMCP_SDK Hello World

Post by Walter »

keithdalby wrote:
Thu Oct 04, 2018 6:07 am
Walter wrote:
Thu Oct 04, 2018 4:28 am
It just looks strange to me. :?
Don't take it personally: even American presidents have difficulties with this.
:lol: Expected something like that. My fault. :D
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
toml_12953
Posts: 795
Joined: Wed May 03, 2017 7:46 pm
Location: Malone, NY USA

Re: DMCP_SDK Hello World

Post by toml_12953 »

Walter wrote:
Wed Oct 03, 2018 10:11 pm
Dunno about the spelling at stardate 4900, but nowadays torpedos are torpedos (don't take this personally: even American presidents have difficulties with this trailing syllable in plural ;)).
In the USA, either way is acceptable with words ending in o (potato, tomato, torpedo, etc.) in fact most people I know still use the e.
Tom L

Some people call me inept but I'm as ept as anybody!
DM10L SN: 059/100
DM41X SN: 00023 (Beta)
DM41X SN: 00506 (Shipping)
DM42 SN: 00025 (Beta)
DM42 SN: 00221 (Shipping)
WP43 SN: 00025 (Prototype)
Post Reply