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.
Vitasam

Re: DMCP_SDK Hello World

Post by Vitasam »

Hi,

one can compare documentation level of open-source Numworks calculator with DM42 APIs:
https://hackaday.com/2018/05/18/open-so ... mentation/

How to say politely? Light years ahead ...
User avatar
Jaymos
Posts: 1635
Joined: Sun Nov 04, 2018 7:03 pm
Location: Cape Town

Re: DMCP_SDK Hello World

Post by Jaymos »

Hi,

I used the advice in this thread to build DMCP_SDK, SDK-Demo & DM42PGM successfully on Windows 10.

- I did not check the hash checksums.
- I did load the PGM files into the DM42 and all 3 worked!

It took me many hours of trying different ARM tools and diiferent MINGW downloads and some hours to figure out that only "mingw-get-setup.exe" V1.0 and only "gcc-arm-none-eabi-7-2017-q4-major-win32.exe" works. Without this combination, many different unrelated compile errors are coming and the target is not built.

Thank you so much for the advice in this thread which enabled me to set up a build system. It is not difficult (I am not a software dev), just heed the above advice, and the old version of gcc-arm tools - it does work.

Jaco

Vitasam wrote:
Fri Jun 15, 2018 3:43 pm
Thomas_ER wrote:
Fri Jun 15, 2018 3:19 pm
I got it
Ok good! Did you try the .pgm file in real DM42? In my case the hash check was failed
Jaco Mostert
Elec Eng, South Africa
https://47calc.com C47 (s/n 03818 & 06199), WP43 (0015). In box: HP42S, HP32Sii, WP34S&C, HP28C, HP35s, EL-506P, EL-W506, PB700; ex: FX702P, 11C, HP67 & HP85; iOS: 42s Byron, Free42+, WP31S/34S, HCalc.
Vitasam

Re: DMCP_SDK Hello World

Post by Vitasam »

Hi,
Jaymos wrote:
Sun Mar 31, 2019 6:04 pm
It took me many hours of trying different ARM tools and diiferent MINGW downloads and some hours to figure out that only "mingw-get-setup.exe" V1.0 and only "gcc-arm-none-eabi-7-2017-q4-major-win32.exe" works.
Good that it works now!

Maybe I will create a separate forum thread about environment settings for Windows.

BR,Vitali

P.S. I have switched from Lnux laptop to a new one, under Windows 10. And I stopped to use old command line tool - PowerShell works very well.
chris185
Posts: 31
Joined: Tue May 23, 2023 11:59 am

Re: DMCP_SDK Hello World

Post by chris185 »

Hi,

I thought I'd report on my efforts to get this working.



I installed arm-binutils, arm-gcc and arm-gdb on a Linux system (Slackware 15.0).

That's the arm-none-eabi- tools (v. 2.35, 10.2.0 and 10.1 respectively).

I found I also needed to install newlib (v 3.0.0) -- not mentioned anywhere?

Then I got the error:

Code: Select all

In file included from dmcp/sys/pgm_syscalls.c:56:
src/qspi_crc.h:3:24: error: invalid suffix "x" on integer constant
    3 | #define QSPI_DATA_CRC  0x
      |                        ^~
dmcp/sys/pgm_syscalls.c:71:2: note: in expansion of macro 'QSPI_DATA_CRC'
   71 |  QSPI_DATA_CRC,         // uint32_t qspi_crc;
      |  ^~~~~~~~~~~~~
And indeed src/qspi_crc.h was:

Code: Select all

#define QSPI_DATA_SIZE 1370864
#define QSPI_DATA_CRC  0x

It turns out that I didn't have a crc32 command and bin/check_qspi_crc was failing silently.

I installed the crc_simple package.


Then I ran make (twice) and all is ok.

I still get two odd warnings:

Code: Select all

In file included from src/main.c:46:
src/main.c: In function 'add_edit_key':
src/main.c:482:83: warning: array subscript has type 'char' [-Wchar-subscripts]
  482 |       if ( !dot && ((len == 1 && ed[0] == '0') || (ed[len-1] == '0' && !isdigit(ed[len-2]))) )
      |                                                                                 ~~^~~~~~~
src/main.c: In function 'num_format':
src/main.c:283:7: warning: 'strncat' output truncated copying between 0 and 3 bytes from a string of length 38 [-Wstringop-truncation]
  283 |       strncat(str, zeros, zfad); mode_digits-=zfad;
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~

The first one is weird, because 'len' is an int, not a char.

The second one, I have no idea.



So, basically, I had to install newlib and crc32 in addition to the normal arm-none-eabi toolchain.
chris185
Posts: 31
Joined: Tue May 23, 2023 11:59 am

Re: DMCP_SDK Hello World

Post by chris185 »

..and a stupid question :)

Can one load/run a .pgm file on the simulator (C47 or any other)? There doesn't appear to be SETUP->SYSTEM or SETUP->DMCP.

Can one compile c47 such that it runs an arbitrary .pgm file ?


PS. could someone define the terms 'simulator' and 'emulator'?
dlachieze
Posts: 613
Joined: Thu May 04, 2017 12:20 pm
Location: France

Re: DMCP_SDK Hello World

Post by dlachieze »

chris185 wrote:
Fri Jun 09, 2023 3:18 pm
Can one load/run a .pgm file on the simulator (C47 or any other)? There doesn't appear to be SETUP->SYSTEM or SETUP->DMCP.
No because a .pgm is a program compiled to run on the real calculator hardware (ARM CPU) on top of the DMCP OS, while a simulator such the one for the C47 or the WP43 is running on top of Windows or macOS with a x86 or Apple Mx CPU.

An emulator would emulate the calculator hardware and CPU, allowing to run DMCP and .pgm programs as on the the real calculator.

For example the DM1x are running an emulator of the HP Voyager hardware and CPU and run the original ROMS.
chris185 wrote:
Fri Jun 09, 2023 3:18 pm

Can one compile c47 such that it runs an arbitrary .pgm file ?
No.
DM42: 00425 - DM41X: β00066 - WP43: 00042
chris185
Posts: 31
Joined: Tue May 23, 2023 11:59 am

Re: DMCP_SDK Hello World

Post by chris185 »

Ah thanks. Yes, that makes sense.
c3d
Posts: 54
Joined: Fri Sep 02, 2022 2:24 pm

Re: DMCP_SDK Hello World

Post by c3d »

Just in case someone tries to run C++ programs, you need a couple of simple patches to DMCP.

https://github.com/swissmicros/DMCP5_SD ... SDK:master

https://github.com/swissmicros/SDKdemo/ ... M42:master
Post Reply