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: 113
Joined: Fri Dec 15, 2017 1:34 pm
Location: Manchester, UK

Re: DMCP_SDK Hello World

Post by ijabbott » Sat Jun 16, 2018 5:42 pm

Vitasam wrote:
Thu Jun 14, 2018 8:56 pm
ijabbott wrote:
Thu Jun 14, 2018 8: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.

User avatar
Vitasam
Posts: 217
Joined: Thu Jun 01, 2017 9:51 am
Location: Finland
Contact:

Re: DMCP_SDK Hello World

Post by Vitasam » Mon Oct 01, 2018 1:12 pm

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 586 times
Elektronika MK-61, Elektronika MK-52, HP15c LE, DM42 SN#16 FW 3.11

User avatar
Vitasam
Posts: 217
Joined: Thu Jun 01, 2017 9:51 am
Location: Finland
Contact:

How to set monospace font?

Post by Vitasam » Wed Oct 03, 2018 8:00 pm

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 539 times
Elektronika MK-61, Elektronika MK-52, HP15c LE, DM42 SN#16 FW 3.11

User avatar
Walter
Posts: 818
Joined: Tue May 02, 2017 9:13 am
Location: Close to FRA, Germany

Re: DMCP_SDK Hello World

Post by Walter » Wed Oct 03, 2018 8: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 ;)).
DM42 SN: 00041 --- Follower of Platon.

HP-35, HP-45, ..., HP-50, WP 34S, WP 31S, DM16L

User avatar
Vitasam
Posts: 217
Joined: Thu Jun 01, 2017 9:51 am
Location: Finland
Contact:

Super StarTrek at DM42

Post by Vitasam » Wed Oct 03, 2018 8:22 pm

Walter wrote:
Wed Oct 03, 2018 8: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.
Elektronika MK-61, Elektronika MK-52, HP15c LE, DM42 SN#16 FW 3.11

User avatar
ijabbott
Posts: 113
Joined: Fri Dec 15, 2017 1:34 pm
Location: Manchester, UK

Re: DMCP_SDK Hello World

Post by ijabbott » Wed Oct 03, 2018 9:26 pm

Walter wrote:
Wed Oct 03, 2018 8: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: 818
Joined: Tue May 02, 2017 9:13 am
Location: Close to FRA, Germany

Re: DMCP_SDK Hello World

Post by Walter » Thu Oct 04, 2018 2:28 am

ijabbott wrote:
Wed Oct 03, 2018 9:26 pm
I'm pretty sure torpedoes is correct.
I stand corrected. It just looks strange to me. :?
DM42 SN: 00041 --- Follower of Platon.

HP-35, HP-45, ..., HP-50, WP 34S, WP 31S, DM16L

keithdalby
Posts: 498
Joined: Mon Apr 24, 2017 6:38 pm

Re: DMCP_SDK Hello World

Post by keithdalby » Thu Oct 04, 2018 4:07 am

Walter wrote:
Thu Oct 04, 2018 2:28 am
It just looks strange to me. :?
Don't take it personally: even American presidents have difficulties with this.

User avatar
Walter
Posts: 818
Joined: Tue May 02, 2017 9:13 am
Location: Close to FRA, Germany

Re: DMCP_SDK Hello World

Post by Walter » Thu Oct 04, 2018 4:48 am

keithdalby wrote:
Thu Oct 04, 2018 4:07 am
Walter wrote:
Thu Oct 04, 2018 2: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
DM42 SN: 00041 --- Follower of Platon.

HP-35, HP-45, ..., HP-50, WP 34S, WP 31S, DM16L

toml_12953
Posts: 447
Joined: Wed May 03, 2017 5:46 pm
Location: Malone, NY USA

Re: DMCP_SDK Hello World

Post by toml_12953 » Thu Oct 04, 2018 8:04 pm

Walter wrote:
Wed Oct 03, 2018 8: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

Ducator meus nihil agit sine lagunculae leynidae accedunt

DM42 SN: 00025 (Beta)
SN: 00221 (Shipping)

Post Reply