32 |
33 | {%- if site.disqus.shortname -%}
34 | {%- include disqus_comments.html -%}
35 | {%- endif -%}
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/dmcp/startup_pgm.s:
--------------------------------------------------------------------------------
1 | /**
2 | */
3 |
4 | .syntax unified
5 | .cpu cortex-m4
6 | .fpu softvfp
7 | .thumb
8 |
9 |
10 | /* == Following section addresses are defined in ld script == */
11 |
12 | /* = initialized data should be copied from flash to RAM before pgm start = */
13 | /* .data section start addr in flash */
14 | .word _sidata
15 | /* .data section start addr in RAM */
16 | .word _sdata
17 | /* .data section end addr in RAM */
18 | .word _edata
19 |
20 | /* = .bss section should be zeroed before pgm start = */
21 | /* .bss section start addr in RAM */
22 | .word _sbss
23 | /* .bss section end addr */
24 | .word _ebss
25 |
26 | /** **/
27 |
28 |
29 | /**
30 | Program entry point
31 | */
32 |
33 | .section .text.Program_Entry
34 | .weak Program_Entry
35 | .type Program_Entry, %function
36 | Program_Entry:
37 |
38 | /* Copy the data segment initializers from flash to SRAM */
39 | ldr r0, =_sidata
40 | ldr r1, =_sdata
41 | ldr r2, =_edata
42 | b CopyDataInit0
43 |
44 | CopyDataInit:
45 | ldr r3, [r0], #4
46 | str r3, [r1], #4
47 | CopyDataInit0:
48 | cmp r1, r2
49 | bcc CopyDataInit
50 |
51 | /* Zero fill the bss segment. */
52 | movs r0, #0
53 | ldr r1, =_sbss
54 | ldr r2, = _ebss
55 | b FillZerobss0
56 |
57 | FillZerobss:
58 | str r0, [r1], #4
59 | FillZerobss0:
60 | cmp r1, r2
61 | bcc FillZerobss
62 |
63 |
64 | /* Call static constructors */
65 | bl __libc_init_array
66 | /* Call the application entry point.*/
67 | bl program_main
68 | bl post_main
69 |
70 | /* Just for sure as post_main shouldn't return. */
71 | LoopForever:
72 | b LoopForever
73 |
74 | .size Program_Entry, .-Program_Entry
75 |
76 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: docu
3 | ---
4 |
5 | # SDKdemo
6 |
7 | [https://tech.swissmicros.com/SDKdemo/](https://tech.swissmicros.com/SDKdemo/)
8 |
9 | ## This repo contains the sources for SDK demo project - simple scientific RPN calculator
10 |
11 | - There is DMCP interface doc in progress see [DMCP IFC doc](http://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/)
12 | (or you can download html zip from [doc directory](http://technical.swissmicros.com/dmcp/doc/)).
13 |
14 |
15 | README file contains basic instructions how to prepare building environment and build the program.
16 |
17 | For the basic SDK with simple 'Hello World!' program look at DMCP_SDK repository.
18 |
19 | You can look at this SDKdemo project for more advanced project with
20 | keyboard handling, more sophisticated LCD printing, power management, build with Intel® Decimal
21 | Floating-Point Math Library, user defined menus and more.
22 |
23 | For ultimate project which uses other aspect of the DMCP system (like system timers, bitmap printing
24 | to LCD or printing to IR printer) look at sources of the DM42PGM project.
25 |
26 | At this time the only source of information about the use of DMCP system interface is based on
27 | the source code of DMCP programs.
28 |
29 | ## The SDK and related material is released as “NOMAS” (NOt MAnufacturer Supported).
30 |
31 | 1. Info is released to assist customers using, exploring and extending the product
32 |
33 | 1. Do NOT contact the manufacturer with questions, seeking support, etc. regarding NOMAS material as no support is implied or committed-to by the Manufacturer
34 |
35 | 1. The Manufacturer may reply and/or update materials if and when needed solely at their discretion
36 |
--------------------------------------------------------------------------------
/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: docu
3 | ---
4 |
5 | # SDKdemo
6 |
7 | [https://github.com/swissmicros/SDKdemo](https://github.com/swissmicros/SDKdemo)
8 |
9 | [readme_build.html](readme_build.html)
10 |
11 | ## This repo contains the sources for SDK demo project - simple scientific RPN calculator
12 |
13 | - There is DMCP interface doc in progress see [DMCP IFC doc](http://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/)
14 | (or you can download html zip from [doc directory](http://technical.swissmicros.com/dmcp/doc/)).
15 |
16 |
17 | README file contains basic instructions how to prepare building environment and build the program.
18 |
19 | For the basic SDK with simple 'Hello World!' program look at DMCP_SDK repository.
20 |
21 | You can look at this SDKdemo project for more advanced project with
22 | keyboard handling, more sophisticated LCD printing, power management, build with Intel® Decimal
23 | Floating-Point Math Library, user defined menus and more.
24 |
25 | For ultimate project which uses other aspect of the DMCP system (like system timers, bitmap printing
26 | to LCD or printing to IR printer) look at sources of the DM42PGM project.
27 |
28 | At this time the only source of information about the use of DMCP system interface is based on
29 | the source code of DMCP programs.
30 |
31 | ## The SDK and related material is released as “NOMAS” (NOt MAnufacturer Supported).
32 |
33 | 1. Info is released to assist customers using, exploring and extending the product
34 |
35 | 1. Do NOT contact the manufacturer with questions, seeking support, etc. regarding NOMAS material as no support is implied or committed-to by the Manufacturer
36 |
37 | 1. The Manufacturer may reply and/or update materials if and when needed solely at their discretion
38 |
--------------------------------------------------------------------------------
/readme.adoc:
--------------------------------------------------------------------------------
1 | '''''
2 |
3 | == layout: docu
4 |
5 | == SDKdemo
6 |
7 | https://tech.swissmicros.com/SDKdemo/[https://tech.swissmicros.com/SDKdemo/]
8 |
9 | === This repo contains the sources for SDK demo project - simple scientific RPN calculator
10 |
11 | * There is DMCP interface doc in progress see
12 | http://technical.swissmicros.com/dmcp/doc/DMCP-ifc-html/[DMCP IFC doc]
13 | (or you can download html zip from
14 | http://technical.swissmicros.com/dmcp/doc/[doc directory]).
15 |
16 | README file contains basic instructions how to prepare building
17 | environment and build the program.
18 |
19 | For the basic SDK with simple 'Hello World!' program look at DMCP_SDK
20 | repository.
21 |
22 | You can look at this SDKdemo project for more advanced project with
23 | keyboard handling, more sophisticated LCD printing, power management,
24 | build with Intel® Decimal Floating-Point Math Library, user defined
25 | menus and more.
26 |
27 | For ultimate project which uses other aspect of the DMCP system (like
28 | system timers, bitmap printing to LCD or printing to IR printer) look at
29 | sources of the DM42PGM project.
30 |
31 | At this time the only source of information about the use of DMCP system
32 | interface is based on the source code of DMCP programs.
33 |
34 | [[the-sdk-and-related-material-is-released-as-nomas-not-manufacturer-supported]]
35 | === The SDK and related material is released as “NOMAS” (NOt MAnufacturer Supported).
36 |
37 | . Info is released to assist customers using, exploring and extending
38 | the product
39 | . Do NOT contact the manufacturer with questions, seeking support, etc.
40 | regarding NOMAS material as no support is implied or committed-to by the
41 | Manufacturer
42 | . The Manufacturer may reply and/or update materials if and when needed
43 | solely at their discretion
44 |
--------------------------------------------------------------------------------
/_layouts/home.html:
--------------------------------------------------------------------------------
1 | ---
2 | layout: default
3 | ---
4 |
5 |
62 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | BSD 3-Clause License
4 |
5 | Copyright (c) 2015-2025, SwissMicros
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions are met:
10 |
11 | * Redistributions of source code must retain the above copyright notice, this
12 | list of conditions and the following disclaimer.
13 |
14 | * Redistributions in binary form must reproduce the above copyright notice,
15 | this list of conditions and the following disclaimer in the documentation
16 | and/or other materials provided with the distribution.
17 |
18 | * Neither the name of the copyright holder nor the names of its
19 | contributors may be used to endorse or promote products derived from
20 | this software without specific prior written permission.
21 |
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 |
33 |
34 | The software and related material is released as “NOMAS” (NOt MAnufacturer Supported).
35 |
36 | 1. Info is released to assist customers using, exploring and extending the product
37 | 2. Do NOT contact the manufacturer with questions, seeking support, etc. regarding
38 | NOMAS material as no support is implied or committed-to by the Manufacturer
39 | 3. The Manufacturer may reply and/or update materials if and when needed solely
40 | at their discretion
41 |
42 | */
43 |
--------------------------------------------------------------------------------
/src/qspi_crc.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | BSD 3-Clause License
4 |
5 | Copyright (c) 2015-2025, SwissMicros
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions are met:
10 |
11 | * Redistributions of source code must retain the above copyright notice, this
12 | list of conditions and the following disclaimer.
13 |
14 | * Redistributions in binary form must reproduce the above copyright notice,
15 | this list of conditions and the following disclaimer in the documentation
16 | and/or other materials provided with the distribution.
17 |
18 | * Neither the name of the copyright holder nor the names of its
19 | contributors may be used to endorse or promote products derived from
20 | this software without specific prior written permission.
21 |
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 |
33 |
34 | The software and related material is released as “NOMAS” (NOt MAnufacturer Supported).
35 |
36 | 1. Info is released to assist customers using, exploring and extending the product
37 | 2. Do NOT contact the manufacturer with questions, seeking support, etc. regarding
38 | NOMAS material as no support is implied or committed-to by the Manufacturer
39 | 3. The Manufacturer may reply and/or update materials if and when needed solely
40 | at their discretion
41 |
42 | */
43 |
44 | #define QSPI_DATA_SIZE 1370864
45 | #define QSPI_DATA_CRC 0x000cfed6
46 |
47 |
--------------------------------------------------------------------------------
/src/main.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | BSD 3-Clause License
4 |
5 | Copyright (c) 2015-2025, SwissMicros
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions are met:
10 |
11 | * Redistributions of source code must retain the above copyright notice, this
12 | list of conditions and the following disclaimer.
13 |
14 | * Redistributions in binary form must reproduce the above copyright notice,
15 | this list of conditions and the following disclaimer in the documentation
16 | and/or other materials provided with the distribution.
17 |
18 | * Neither the name of the copyright holder nor the names of its
19 | contributors may be used to endorse or promote products derived from
20 | this software without specific prior written permission.
21 |
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 |
33 |
34 | The software and related material is released as “NOMAS” (NOt MAnufacturer Supported).
35 |
36 | 1. Info is released to assist customers using, exploring and extending the product
37 | 2. Do NOT contact the manufacturer with questions, seeking support, etc. regarding
38 | NOMAS material as no support is implied or committed-to by the Manufacturer
39 | 3. The Manufacturer may reply and/or update materials if and when needed solely
40 | at their discretion
41 |
42 | */
43 | #ifndef __PGM_MAIN_H__
44 | #define __PGM_MAIN_H__
45 |
46 | #define PROGRAM_NAME "SDKdemo"
47 | #define PROGRAM_VERSION "1.0"
48 |
49 | #define DBG_PRINT
50 |
51 | #ifdef DBG_PRINT
52 | #include
53 | #else
54 | #define printf(...)
55 | #define puts(...)
56 | #endif
57 |
58 | #endif
59 |
--------------------------------------------------------------------------------
/src/menu.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | BSD 3-Clause License
4 |
5 | Copyright (c) 2015-2025, SwissMicros
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions are met:
10 |
11 | * Redistributions of source code must retain the above copyright notice, this
12 | list of conditions and the following disclaimer.
13 |
14 | * Redistributions in binary form must reproduce the above copyright notice,
15 | this list of conditions and the following disclaimer in the documentation
16 | and/or other materials provided with the distribution.
17 |
18 | * Neither the name of the copyright holder nor the names of its
19 | contributors may be used to endorse or promote products derived from
20 | this software without specific prior written permission.
21 |
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 |
33 |
34 | The software and related material is released as “NOMAS” (NOt MAnufacturer Supported).
35 |
36 | 1. Info is released to assist customers using, exploring and extending the product
37 | 2. Do NOT contact the manufacturer with questions, seeking support, etc. regarding
38 | NOMAS material as no support is implied or committed-to by the Manufacturer
39 | 3. The Manufacturer may reply and/or update materials if and when needed solely
40 | at their discretion
41 |
42 | */
43 | #ifndef __MENU_H__
44 | #define __MENU_H__
45 |
46 | // --------------------------------
47 | // Menu items
48 | // app range 0-127
49 | // sys range 128-255
50 | // --------------------------------
51 |
52 | #define MI_SETTINGS 10
53 | #define MI_ABOUT_PGM 11
54 |
55 | extern const smenu_t MID_MENU;
56 |
57 |
58 | // Menu callbacks
59 | int run_menu_item(uint8_t line_id);
60 | const char * menu_line_str(uint8_t line_id, char * s, const int slen);
61 |
62 | #endif
63 |
--------------------------------------------------------------------------------
/dmcp/qrcode.h:
--------------------------------------------------------------------------------
1 | /**
2 | * The MIT License (MIT)
3 | *
4 | * This library is written and maintained by Richard Moore.
5 | * Major parts were derived from Project Nayuki's library.
6 | *
7 | * Copyright (c) 2017 Richard Moore (https://github.com/ricmoo/QRCode)
8 | * Copyright (c) 2017 Project Nayuki (https://www.nayuki.io/page/qr-code-generator-library)
9 | *
10 | * Permission is hereby granted, free of charge, to any person obtaining a copy
11 | * of this software and associated documentation files (the "Software"), to deal
12 | * in the Software without restriction, including without limitation the rights
13 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 | * copies of the Software, and to permit persons to whom the Software is
15 | * furnished to do so, subject to the following conditions:
16 | *
17 | * The above copyright notice and this permission notice shall be included in
18 | * all copies or substantial portions of the Software.
19 | *
20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 | * THE SOFTWARE.
27 | */
28 |
29 | /**
30 | * Special thanks to Nayuki (https://www.nayuki.io/) from which this library was
31 | * heavily inspired and compared against.
32 | *
33 | * See: https://github.com/nayuki/QR-Code-generator/tree/master/cpp
34 | */
35 |
36 | #ifndef __QRCODE_H_
37 | #define __QRCODE_H_
38 |
39 | #ifndef __cplusplus
40 | typedef unsigned char bool;
41 | static const bool false = 0;
42 | static const bool true = 1;
43 | #endif
44 |
45 | #include
46 |
47 |
48 | // QR Code Format Encoding
49 | #define MODE_NUMERIC 0
50 | #define MODE_ALPHANUMERIC 1
51 | #define MODE_BYTE 2
52 |
53 |
54 | // Error Correction Code Levels
55 | #define ECC_LOW 0
56 | #define ECC_MEDIUM 1
57 | #define ECC_QUARTILE 2
58 | #define ECC_HIGH 3
59 |
60 |
61 | // If set to non-zero, this library can ONLY produce QR codes at that version
62 | // This saves a lot of dynamic memory, as the codeword tables are skipped
63 | #ifndef LOCK_VERSION
64 | #define LOCK_VERSION 0
65 | #endif
66 |
67 |
68 | typedef struct QRCode {
69 | uint8_t version;
70 | uint8_t size;
71 | uint8_t ecc;
72 | uint8_t mode;
73 | uint8_t mask;
74 | uint8_t *modules;
75 | } QRCode;
76 |
77 |
78 | #ifdef __cplusplus
79 | extern "C"{
80 | #endif /* __cplusplus */
81 |
82 |
83 |
84 | uint16_t qrcode_getBufferSize(uint8_t version);
85 |
86 | int8_t qrcode_initText(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, const char *data);
87 | int8_t qrcode_initBytes(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, uint8_t *data, uint16_t length);
88 |
89 | bool qrcode_getModule(QRCode *qrcode, uint8_t x, uint8_t y);
90 |
91 |
92 |
93 | #ifdef __cplusplus
94 | }
95 | #endif /* __cplusplus */
96 |
97 |
98 | #endif /* __QRCODE_H_ */
99 |
--------------------------------------------------------------------------------
/_layouts/dirlisting.html:
--------------------------------------------------------------------------------
1 | ---
2 | layout: docu
3 | ---
4 | {% assign abs_url = page.url | absolute_url %}
5 | {% assign rel_url = page.url | relative_url %}
6 | {% if rel_url != '/' %} {% assign base_url = abs_url | replace: rel_url, '' | append: '/' %}
7 | {% else %} {% assign base_url = abs_url %}
8 | {% endif %}
9 | {% assign depth = page.path | split: '/' | size %}
10 | {% assign pwd = page.path | replace: page.name, '' %}
11 |
12 |
87 |
--------------------------------------------------------------------------------
/src/num.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | BSD 3-Clause License
4 |
5 | Copyright (c) 2015-2025, SwissMicros
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions are met:
10 |
11 | * Redistributions of source code must retain the above copyright notice, this
12 | list of conditions and the following disclaimer.
13 |
14 | * Redistributions in binary form must reproduce the above copyright notice,
15 | this list of conditions and the following disclaimer in the documentation
16 | and/or other materials provided with the distribution.
17 |
18 | * Neither the name of the copyright holder nor the names of its
19 | contributors may be used to endorse or promote products derived from
20 | this software without specific prior written permission.
21 |
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 |
33 |
34 | The software and related material is released as “NOMAS” (NOt MAnufacturer Supported).
35 |
36 | 1. Info is released to assist customers using, exploring and extending the product
37 | 2. Do NOT contact the manufacturer with questions, seeking support, etc. regarding
38 | NOMAS material as no support is implied or committed-to by the Manufacturer
39 | 3. The Manufacturer may reply and/or update materials if and when needed solely
40 | at their discretion
41 |
42 | */
43 | #ifndef __NUM_H__
44 | #define __NUM_H__
45 |
46 | /*
47 | ▄▄ ▄
48 | █▀▄ █ ▄ ▄ ▄▄▄▄▄
49 | █ █▄ █ █ █ █ █ █
50 | █ █ █ █ █ █ █ █
51 | █ ██ ▀▄▄▀█ █ █ █
52 |
53 | */
54 |
55 |
56 | #include
57 | #include
58 |
59 | typedef BID_UINT128 num_t;
60 |
61 | #define NUM_MAX_MANTISSA_DIGITS 34
62 |
63 | #define num_to_string bid128_to_string
64 | #define num_from_int32 bid128_from_int32
65 |
66 | #define num_to_string bid128_to_string
67 | #define num_from_string bid128_from_string
68 |
69 | #define num_to_int bid128_to_int32_int
70 |
71 | #define num_add bid128_add
72 | #define num_sub bid128_sub
73 | #define num_mul bid128_mul
74 | #define num_div bid128_div
75 |
76 | #define num_abs bid128_abs
77 | #define num_pow bid128_pow
78 | #define num_exp bid128_exp
79 | #define num_exp10 bid128_exp10
80 | #define num_sqrt bid128_sqrt
81 | #define num_log bid128_log
82 | #define num_log10 bid128_log10
83 | #define num_sin bid128_sin
84 | #define num_cos bid128_cos
85 | #define num_tan bid128_tan
86 | #define num_asin bid128_asin
87 | #define num_acos bid128_acos
88 | #define num_atan bid128_atan
89 |
90 | #define num_gt bid128_quiet_greater
91 | #define num_eq bid128_quiet_equal
92 | #define num_lt bid128_quiet_less
93 | #define num_le bid128_quiet_less_equal
94 | #define num_ne bid128_quiet_not_equal
95 | #define num_ge bid128_quiet_greater_equal
96 |
97 | #endif
98 |
--------------------------------------------------------------------------------
/dmcp/sys/sdb.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | BSD 3-Clause License
4 |
5 | Copyright (c) 2015-2019, SwissMicros
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions are met:
10 |
11 | * Redistributions of source code must retain the above copyright notice, this
12 | list of conditions and the following disclaimer.
13 |
14 | * Redistributions in binary form must reproduce the above copyright notice,
15 | this list of conditions and the following disclaimer in the documentation
16 | and/or other materials provided with the distribution.
17 |
18 | * Neither the name of the copyright holder nor the names of its
19 | contributors may be used to endorse or promote products derived from
20 | this software without specific prior written permission.
21 |
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 |
33 |
34 | The software and related material is released as “NOMAS” (NOt MAnufacturer Supported).
35 |
36 | 1. Info is released to assist customers using, exploring and extending the product
37 | 2. Do NOT contact the manufacturer with questions, seeking support, etc. regarding
38 | NOMAS material as no support is implied or committed-to by the Manufacturer
39 | 3. The Manufacturer may reply and/or update materials if and when needed solely
40 | at their discretion
41 |
42 | */
43 | #ifndef __SYS_SDB_H__
44 | #define __SYS_SDB_H__
45 |
46 | // === IFC START ===
47 | // System data block
48 |
49 | typedef int get_flag_fn_t();
50 | typedef void set_flag_fn_t(int val);
51 |
52 | typedef int run_menu_item_fn_t(uint8_t line_id);
53 | typedef const char * menu_line_str_fn_t(uint8_t line_id, char * s, const int slen);
54 |
55 | typedef void void_fn_t();
56 |
57 |
58 | typedef struct {
59 | volatile uint32_t calc_state;
60 | FIL * ppgm_fp;
61 | const char * key_to_alpha_table;
62 |
63 | run_menu_item_fn_t * run_menu_item_app;
64 | menu_line_str_fn_t * menu_line_str_app;
65 |
66 | void_fn_t * after_fat_format;
67 |
68 | get_flag_fn_t * is_flag_dmy;
69 | set_flag_fn_t * set_flag_dmy;
70 | get_flag_fn_t * is_flag_clk24;
71 | set_flag_fn_t * set_flag_clk24;
72 | get_flag_fn_t * is_beep_mute;
73 | set_flag_fn_t * set_beep_mute;
74 |
75 | disp_stat_t * pds_t20;
76 | disp_stat_t * pds_t24;
77 | disp_stat_t * pds_fReg;
78 |
79 | } sys_sdb_t;
80 |
81 |
82 | #define calc_state (sdb.calc_state)
83 | #define ppgm_fp (sdb.ppgm_fp)
84 |
85 | #define key_to_alpha_table (sdb.key_to_alpha_table)
86 |
87 | #define run_menu_item_app (sdb.run_menu_item_app)
88 | #define menu_line_str_app (sdb.menu_line_str_app)
89 |
90 | #define after_fat_format (sdb.after_fat_format)
91 |
92 | #define is_flag_dmy (sdb.is_flag_dmy)
93 | #define set_flag_dmy (sdb.set_flag_dmy)
94 | #define is_flag_clk24 (sdb.is_flag_clk24)
95 | #define set_flag_clk24 (sdb.set_flag_clk24)
96 | #define is_beep_mute (sdb.is_beep_mute)
97 | #define set_beep_mute (sdb.set_beep_mute)
98 |
99 | // === IFC END ===
100 |
101 |
102 | extern sys_sdb_t sdb;
103 |
104 | #if 0
105 | // === IFC START ===
106 |
107 | #define t20 (sdb.pds_t20)
108 | #define t24 (sdb.pds_t24)
109 | #define fReg (sdb.pds_fReg)
110 |
111 | #define sdb (*((sys_sdb_t*)0x10002000))
112 |
113 | // === IFC END ===
114 | #endif
115 |
116 | #endif
117 |
--------------------------------------------------------------------------------
/src/menu.c:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | BSD 3-Clause License
4 |
5 | Copyright (c) 2015-2025, SwissMicros
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions are met:
10 |
11 | * Redistributions of source code must retain the above copyright notice, this
12 | list of conditions and the following disclaimer.
13 |
14 | * Redistributions in binary form must reproduce the above copyright notice,
15 | this list of conditions and the following disclaimer in the documentation
16 | and/or other materials provided with the distribution.
17 |
18 | * Neither the name of the copyright holder nor the names of its
19 | contributors may be used to endorse or promote products derived from
20 | this software without specific prior written permission.
21 |
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 |
33 |
34 | The software and related material is released as “NOMAS” (NOt MAnufacturer Supported).
35 |
36 | 1. Info is released to assist customers using, exploring and extending the product
37 | 2. Do NOT contact the manufacturer with questions, seeking support, etc. regarding
38 | NOMAS material as no support is implied or committed-to by the Manufacturer
39 | 3. The Manufacturer may reply and/or update materials if and when needed solely
40 | at their discretion
41 |
42 | */
43 | #include
44 | #include
45 |
46 | #include
47 |
48 |
49 | const uint8_t mid_menu[] = {
50 | MI_SETTINGS,
51 | MI_MSC,
52 | MI_SYSTEM_ENTER,
53 | MI_ABOUT_PGM,
54 | 0 }; // Terminator
55 |
56 |
57 | const uint8_t mid_settings[] = {
58 | MI_SET_TIME,
59 | MI_SET_DATE,
60 | MI_BEEP_MUTE,
61 | MI_SLOW_AUTOREP,
62 | 0 }; // Terminator
63 |
64 |
65 | const smenu_t MID_MENU = { "Setup", mid_menu, NULL, NULL };
66 | const smenu_t MID_SETTINGS = { "Settings", mid_settings, NULL, NULL};
67 |
68 |
69 |
70 |
71 | void disp_about() {
72 | lcd_clear_buf();
73 | lcd_writeClr(t24);
74 |
75 | // Just base of original system about
76 | lcd_for_calc(DISP_ABOUT);
77 | lcd_putsAt(t24,4,"");
78 | lcd_prevLn(t24);
79 | // --
80 |
81 | int h2 = lcd_lineHeight(t20)/2;
82 | lcd_setXY(t20, t24->x, t24->y);
83 | t20->y += h2;
84 | lcd_print(t20, "SDKdemo v" PROGRAM_VERSION " (C) SwissMicros GmbH");
85 | t20->y += h2;
86 | t20->y += h2;
87 | lcd_puts(t20, "Intel Decimal Floating-Point Math Lib v2.0");
88 | lcd_puts(t20, " (C) 2007-2011, Intel Corp.");
89 |
90 | t20->y = LCD_Y - lcd_lineHeight(t20);
91 | lcd_putsR(t20, " Press EXIT key to continue...");
92 |
93 | lcd_refresh();
94 |
95 | wait_for_key_press();
96 | }
97 |
98 |
99 |
100 | int run_menu_item(uint8_t line_id) {
101 | int ret = 0;
102 |
103 | switch(line_id) {
104 | case MI_ABOUT_PGM:
105 | disp_about();
106 | break;
107 |
108 | case MI_SETTINGS:
109 | ret = handle_menu(&MID_SETTINGS,MENU_ADD, 0);
110 | break;
111 |
112 | default:
113 | ret = MRET_UNIMPL;
114 | break;
115 | }
116 |
117 | return ret;
118 | }
119 |
120 |
121 | const char * menu_line_str(uint8_t line_id, char * s, const int slen) {
122 | const char * ln;
123 |
124 | switch(line_id) {
125 |
126 | case MI_SETTINGS: ln = "Settings >"; break;
127 | case MI_ABOUT_PGM: ln = "About >"; break;
128 |
129 | default:
130 | ln = NULL;
131 | break;
132 | }
133 |
134 | return ln;
135 | }
136 |
--------------------------------------------------------------------------------
/dmcp/sys/pgm_syscalls.c:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | BSD 3-Clause License
4 |
5 | Copyright (c) 2015-2025, SwissMicros
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions are met:
10 |
11 | * Redistributions of source code must retain the above copyright notice, this
12 | list of conditions and the following disclaimer.
13 |
14 | * Redistributions in binary form must reproduce the above copyright notice,
15 | this list of conditions and the following disclaimer in the documentation
16 | and/or other materials provided with the distribution.
17 |
18 | * Neither the name of the copyright holder nor the names of its
19 | contributors may be used to endorse or promote products derived from
20 | this software without specific prior written permission.
21 |
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 |
33 |
34 | The software and related material is released as “NOMAS” (NOt MAnufacturer Supported).
35 |
36 | 1. Info is released to assist customers using, exploring and extending the product
37 | 2. Do NOT contact the manufacturer with questions, seeking support, etc. regarding
38 | NOMAS material as no support is implied or committed-to by the Manufacturer
39 | 3. The Manufacturer may reply and/or update materials if and when needed solely
40 | at their discretion
41 |
42 | */
43 |
44 | #include
45 | #include
46 | #include
47 | #include
48 | #include
49 | #include
50 | #include
51 | #include
52 |
53 | #include
54 |
55 | #include
56 | #include
57 |
58 | void Program_Entry();
59 |
60 | #ifndef PROGRAM_KEYMAP_ID
61 | #define PROGRAM_KEYMAP_ID 0xffffffff
62 | #endif
63 |
64 | prog_info_t const prog_info = {
65 | PROG_INFO_MAGIC, // uint32_t pgm_magic;
66 | 0, // uint32_t pgm_size;
67 | (void*)Program_Entry, // void * pgm_entry;
68 | PLATFORM_IFC_CNR, // uint32_t ifc_cnr;
69 | PLATFORM_IFC_VER, // uint32_t ifc_ver;
70 | QSPI_DATA_SIZE, // uint32_t qspi_size;
71 | QSPI_DATA_CRC, // uint32_t qspi_crc;
72 | PROGRAM_NAME, // char pgm_name[16];
73 | PROGRAM_VERSION, // char pgm_version[16];
74 | PROGRAM_KEYMAP_ID // uint32_t required_keymap_id;
75 | };
76 |
77 |
78 |
79 | int _read(int file, char *ptr, int len)
80 | {
81 | return len;
82 | }
83 |
84 |
85 | int _write(int file, char *ptr, int len)
86 | {
87 | // Routed to OS, where it is printed to ITM
88 | #ifdef USER_WRITE
89 | return USER_WRITE(file, ptr, len);
90 | #else
91 | return __sysfn__write(file, ptr, len);
92 | #endif
93 | }
94 |
95 |
96 | int _close(int file)
97 | {
98 | return -1;
99 | }
100 |
101 |
102 | int _fstat(int file, struct stat *st)
103 | {
104 | st->st_mode = S_IFCHR;
105 | return 0;
106 | }
107 |
108 | int _isatty(int file)
109 | {
110 | return 1;
111 | }
112 |
113 | int _lseek(int file, int ptr, int dir)
114 | {
115 | return 0;
116 | }
117 |
118 | int _kill(int pid, int sig)
119 | {
120 | errno = EINVAL;
121 | return -1;
122 | }
123 |
124 | int _getpid(void)
125 | {
126 | return 1;
127 | }
128 |
129 |
130 |
131 | // Remove any debug substitutions
132 |
133 | #ifdef malloc
134 | #undef malloc
135 | #endif
136 |
137 | #ifdef free
138 | #undef free
139 | #endif
140 |
141 | #ifdef calloc
142 | #undef calloc
143 | #endif
144 |
145 | #ifdef realloc
146 | #undef realloc
147 | #endif
148 |
149 |
150 | void free(void *ptr) {
151 | __sysfn_free(ptr);
152 | }
153 |
154 |
155 | void *malloc(size_t size) {
156 | return __sysfn_malloc(size);
157 | }
158 |
159 |
160 | void *calloc(size_t count, size_t nbytes) {
161 | return __sysfn_calloc(count, nbytes);
162 | }
163 |
164 | void *realloc(void *ptr, size_t size) {
165 | return __sysfn_realloc(ptr, size);
166 | }
167 |
168 |
169 |
170 | void * __wrap__malloc_r (struct _reent *pr, size_t size) {
171 | return malloc(size);
172 | }
173 |
174 | void * _calloc_r (struct _reent *pr, size_t nmemb, size_t size) {
175 | return calloc(nmemb, size);
176 | }
177 |
178 | void * _realloc_r (struct _reent *pr, void *ptr, size_t size) {
179 | return realloc(ptr, size);
180 | }
181 |
182 | void _free_r (struct _reent *pr, void *ptr) {
183 | free(ptr);
184 | }
185 |
186 |
187 | void post_main() {
188 | // Just start DMCP
189 | set_reset_magic(RUN_DMCP_MAGIC);
190 | sys_reset();
191 | }
192 |
193 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | ######################################
2 | # target
3 | ######################################
4 | TARGET = SDKdemo
5 |
6 | ######################################
7 | # building variables
8 | ######################################
9 | # debug build?
10 | ifdef DEBUG
11 | DEBUG = 1
12 | endif
13 |
14 | #######################################
15 | # pathes
16 | #######################################
17 | # Build path
18 | BUILD_DIR = build
19 |
20 | # Path to aux build scripts (including trailing /)
21 | # Leave empty for scripts in PATH
22 | BIN_DIR = bin/
23 |
24 | ######################################
25 | # System sources
26 | ######################################
27 | C_INCLUDES += -Idmcp
28 | C_SOURCES += dmcp/sys/pgm_syscalls.c
29 | ASM_SOURCES = dmcp/startup_pgm.s
30 |
31 | #######################################
32 | # Custom section
33 | #######################################
34 |
35 | # Includes
36 | C_INCLUDES += -Isrc -Iinc
37 |
38 | # C sources
39 | C_SOURCES += src/main.c
40 | C_SOURCES += src/menu.c
41 |
42 | # C++ sources
43 | #CXX_SOURCES += src/xxx.cc
44 |
45 | # ASM sources
46 | #ASM_SOURCES += src/xxx.s
47 |
48 | # Additional defines
49 | #C_DEFS += -DXXX
50 |
51 | # Intel library related defines
52 | C_DEFS += -DDECIMAL_CALL_BY_REFERENCE=1 -DDECIMAL_GLOBAL_ROUNDING=1 \
53 | -DDECIMAL_GLOBAL_ROUNDING_ACCESS_FUNCTIONS=1 -DDECIMAL_GLOBAL_EXCEPTION_FLAGS=1 \
54 | -DDECIMAL_GLOBAL_EXCEPTION_FLAGS_ACCESS_FUNCTIONS=1
55 |
56 | # Libraries
57 | ifeq ($(DEBUG), 1)
58 | LIBS += lib/gcc111libbid_hard.a
59 | else
60 | LIBS += lib/gcc111libbid_hard.a
61 | endif
62 |
63 | # ---
64 |
65 |
66 | #######################################
67 | # binaries
68 | #######################################
69 | CC = arm-none-eabi-gcc
70 | CXX = arm-none-eabi-g++
71 | AS = arm-none-eabi-gcc -x assembler-with-cpp
72 | OBJCOPY = arm-none-eabi-objcopy
73 | AR = arm-none-eabi-ar
74 | SIZE = arm-none-eabi-size
75 | HEX = $(OBJCOPY) -O ihex
76 | BIN = $(OBJCOPY) -O binary -S
77 |
78 | #######################################
79 | # CFLAGS
80 | #######################################
81 | # macros for gcc
82 | AS_DEFS =
83 | C_DEFS += -D__weak="__attribute__((weak))" -D__packed="__attribute__((__packed__))"
84 | AS_INCLUDES =
85 |
86 |
87 | CPUFLAGS += -mthumb -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16
88 |
89 |
90 | # compile gcc flags
91 | ASFLAGS = $(CPUFLAGS) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
92 | CFLAGS = $(CPUFLAGS) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
93 | CFLAGS += -Wno-misleading-indentation -Wno-stringop-truncation
94 | DBGFLAGS = -g
95 |
96 | ifeq ($(DEBUG), 1)
97 | CFLAGS += -O0 -DDEBUG
98 | else
99 | CFLAGS += -O2
100 | endif
101 |
102 | CFLAGS += $(DBGFLAGS)
103 | LDFLAGS += $(DBGFLAGS)
104 |
105 | # Generate dependency information
106 | CFLAGS += -MD -MP -MF .dep/$(@F).d
107 |
108 | #######################################
109 | # LDFLAGS
110 | #######################################
111 | # link script
112 | LDSCRIPT = stm32_program.ld
113 | LIBDIR =
114 | LDFLAGS += $(CPUFLAGS) -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref
115 | LDFLAGS += -specs=nano.specs
116 | LDFLAGS += -Wl,--gc-sections -Wl,--wrap=_malloc_r
117 |
118 |
119 | # default action: build all
120 | all: $(BUILD_DIR)/$(TARGET).elf
121 |
122 | #######################################
123 | # build the application
124 | #######################################
125 | # list of objects
126 | OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
127 | vpath %.c $(sort $(dir $(C_SOURCES)))
128 | # C++ sources
129 | OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(CXX_SOURCES:.cc=.o)))
130 | vpath %.cc $(sort $(dir $(CXX_SOURCES)))
131 | # list of ASM program objects
132 | OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
133 | vpath %.s $(sort $(dir $(ASM_SOURCES)))
134 |
135 | CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
136 |
137 | $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
138 | $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
139 |
140 | $(BUILD_DIR)/%.o: %.cc Makefile | $(BUILD_DIR)
141 | $(CXX) -c $(CXXFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.cc=.lst)) $< -o $@
142 |
143 | $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
144 | $(AS) -c $(CFLAGS) $< -o $@
145 |
146 | $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
147 | $(CC) $(OBJECTS) $(LDFLAGS) -o $@
148 | $(OBJCOPY) --remove-section .qspi -O ihex $@ $(BUILD_DIR)/$(TARGET)_flash.hex
149 | $(OBJCOPY) --remove-section .qspi -O binary $@ $(BUILD_DIR)/$(TARGET)_flash.bin
150 | $(OBJCOPY) --only-section .qspi -O ihex $@ $(BUILD_DIR)/$(TARGET)_qspi.hex
151 | $(OBJCOPY) --only-section .qspi -O binary $@ $(BUILD_DIR)/$(TARGET)_qspi.bin
152 | $(BIN_DIR)check_qspi_crc $(TARGET) src/qspi_crc.h || ( $(MAKE) clean && false )
153 | $(BIN_DIR)add_pgm_chsum build/$(TARGET)_flash.bin build/$(TARGET).pgm
154 | $(SIZE) $@
155 |
156 | $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
157 | $(HEX) $< $@
158 |
159 | $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
160 | $(BIN) $< $@
161 |
162 | $(BUILD_DIR):
163 | mkdir -p $@
164 |
165 | #######################################
166 | # clean up
167 | #######################################
168 | clean:
169 | -rm -fR .dep $(BUILD_DIR)/*.o $(BUILD_DIR)/*.lst
170 |
171 | #######################################
172 | # dependencies
173 | #######################################
174 | -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
175 |
176 | .PHONY: clean all
177 |
178 | # *** EOF ***
179 |
--------------------------------------------------------------------------------
/stm32_program.ld:
--------------------------------------------------------------------------------
1 | /*
2 | *****************************************************************************
3 | **
4 |
5 | ** File : stm32_flash.ld
6 | **
7 | ** Abstract : Linker script for STM32L476ZG Device with
8 | ** 1024KByte FLASH, 96KByte RAM
9 | **
10 | ** Set heap size, stack size and stack location according
11 | ** to application requirements.
12 | **
13 | ** Set memory bank area and size if external memory is used.
14 | **
15 | ** Target : STMicroelectronics STM32
16 | **
17 | **
18 | ** Distribution: The file is distributed as is, without any warranty
19 | ** of any kind.
20 | **
21 | ** Swissmicros - ld script for STM32 + QSPI
22 | **
23 | *****************************************************************************
24 | */
25 |
26 | /* Specify the memory areas */
27 | MEMORY
28 | {
29 | /* FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K */
30 | /* RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K */
31 | /* RAM0 (xrw) : ORIGIN = 0x10000000, LENGTH = 32K-256 */
32 | FLASH (rx) : ORIGIN = 0x8050000, LENGTH = 704K
33 | RAM (xrw) : ORIGIN = 0x10000000, LENGTH = 8K
34 | QSPI (rx) : ORIGIN = 0x90000000, LENGTH = 2048K
35 | }
36 |
37 | /* Entry Point */
38 | ENTRY(Program_Entry)
39 |
40 |
41 | /* Define output sections */
42 | SECTIONS
43 | {
44 |
45 | .qspi :
46 | {
47 | . = ALIGN(8);
48 | _qspi_start = .; /* create a global symbol at qspi start */
49 | *(.qspi) /* .qspi sections */
50 | *(.qspi*) /* .qspi* sections */
51 | /* ==== Symbols to QSPI - in direct order === */
52 | *(.rodata.__bid_mod10_18_tbl)
53 | *(.rodata.__bid_convert_table)
54 | *(.rodata.bid_log_table_1)
55 | *(.rodata.bid_log_table_2)
56 | *(.rodata.bid_decimal128_moduli)
57 | *(.rodata.bid_exponents_bid64)
58 | *(.rodata.bid_exponents_binary128)
59 | *(.rodata.bid_breakpoints_binary128)
60 | *(.rodata.bid_breakpoints_bid64)
61 | *(.rodata.bid_multipliers1_binary128)
62 | *(.rodata.bid_multipliers2_bid64)
63 | *(.rodata.bid_multipliers1_bid64)
64 | *(.rodata.bid_multipliers2_binary128)
65 | /* ======================== */
66 | . = ALIGN(8);
67 | _qspi_end = .; /* define a global symbols at end of qspi */
68 |
69 | } >QSPI /* AT> FLASH */
70 |
71 | /* Constant data goes into FLASH */
72 | .rodata :
73 | {
74 | KEEP(*(.rodata.prog_info)) /* Program info */
75 | . = ALIGN(64);
76 | *(.rodata) /* .rodata sections (constants, strings, etc.) */
77 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
78 | . = ALIGN(8);
79 | } >FLASH
80 |
81 | _qspi_init_base = LOADADDR(.qspi);
82 | _qspi_init_length = SIZEOF(.qspi);
83 |
84 | /* The program code and other data goes into FLASH */
85 | .text :
86 | {
87 | . = ALIGN(8);
88 | *(.text) /* .text sections (code) */
89 | *(.text*) /* .text* sections (code) */
90 | *(.glue_7) /* glue arm to thumb code */
91 | *(.glue_7t) /* glue thumb to arm code */
92 | *(.eh_frame)
93 |
94 | KEEP (*(.init))
95 | KEEP (*(.fini))
96 |
97 | . = ALIGN(8);
98 | _etext = .; /* define a global symbols at end of code */
99 | } >FLASH
100 |
101 | .ARM.extab :
102 | {
103 | . = ALIGN(8);
104 | *(.ARM.extab* .gnu.linkonce.armextab.*)
105 | . = ALIGN(8);
106 | } >FLASH
107 | .ARM : {
108 | . = ALIGN(8);
109 | __exidx_start = .;
110 | *(.ARM.exidx*)
111 | __exidx_end = .;
112 | . = ALIGN(8);
113 | } >FLASH
114 |
115 | .preinit_array :
116 | {
117 | . = ALIGN(8);
118 | PROVIDE_HIDDEN (__preinit_array_start = .);
119 | KEEP (*(.preinit_array*))
120 | PROVIDE_HIDDEN (__preinit_array_end = .);
121 | . = ALIGN(8);
122 | } >FLASH
123 |
124 | .init_array :
125 | {
126 | . = ALIGN(8);
127 | PROVIDE_HIDDEN (__init_array_start = .);
128 | KEEP (*(SORT(.init_array.*)))
129 | KEEP (*(.init_array*))
130 | PROVIDE_HIDDEN (__init_array_end = .);
131 | . = ALIGN(8);
132 | } >FLASH
133 | .fini_array :
134 | {
135 | . = ALIGN(8);
136 | PROVIDE_HIDDEN (__fini_array_start = .);
137 | KEEP (*(SORT(.fini_array.*)))
138 | KEEP (*(.fini_array*))
139 | PROVIDE_HIDDEN (__fini_array_end = .);
140 | . = ALIGN(8);
141 | } >FLASH
142 |
143 | /* used by the startup to initialize data */
144 | _sidata = LOADADDR(.data);
145 |
146 | /* Initialized data sections goes into RAM, load LMA copy after code */
147 | .data :
148 | {
149 | . = ALIGN(8);
150 | _sdata = .; /* create a global symbol at data start */
151 | *(.data.sdb) /* SDB at the beginning of the RAM0 */
152 | *(.data) /* .data sections */
153 | *(.data*) /* .data* sections */
154 |
155 | . = ALIGN(8);
156 | _edata = .; /* define a global symbol at data end */
157 | } >RAM AT> FLASH
158 |
159 | /* Uninitialized data section */
160 | . = ALIGN(4);
161 | .bss :
162 | {
163 | /* This is used by the startup in order to initialize the .bss secion */
164 | _sbss = .; /* define a global symbol at bss start */
165 | __bss_start__ = _sbss;
166 | *(.bss)
167 | *(.bss*)
168 | *(COMMON)
169 |
170 | . = ALIGN(4);
171 | _ebss = .; /* define a global symbol at bss end */
172 | __bss_end__ = _ebss;
173 | } >RAM AT> RAM
174 |
175 | /* Remove information from the standard libraries */
176 | /DISCARD/ :
177 | {
178 | libc.a ( * )
179 | libm.a ( * )
180 | libgcc.a ( * )
181 | }
182 |
183 | .ARM.attributes 0 : { *(.ARM.attributes) }
184 | }
185 |
186 |
187 |
--------------------------------------------------------------------------------
/dmcp/ff_ifc.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | BSD 3-Clause License
4 |
5 | Copyright (c) 2015-2025, SwissMicros
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions are met:
10 |
11 | * Redistributions of source code must retain the above copyright notice, this
12 | list of conditions and the following disclaimer.
13 |
14 | * Redistributions in binary form must reproduce the above copyright notice,
15 | this list of conditions and the following disclaimer in the documentation
16 | and/or other materials provided with the distribution.
17 |
18 | * Neither the name of the copyright holder nor the names of its
19 | contributors may be used to endorse or promote products derived from
20 | this software without specific prior written permission.
21 |
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 |
33 |
34 | The software and related material is released as “NOMAS” (NOt MAnufacturer Supported).
35 |
36 | 1. Info is released to assist customers using, exploring and extending the product
37 | 2. Do NOT contact the manufacturer with questions, seeking support, etc. regarding
38 | NOMAS material as no support is implied or committed-to by the Manufacturer
39 | 3. The Manufacturer may reply and/or update materials if and when needed solely
40 | at their discretion
41 |
42 | */
43 | #ifndef __FF_IFC_H__
44 | #define __FF_IFC_H__
45 |
46 |
47 |
48 | /* These types MUST be 16-bit or 32-bit */
49 | typedef int INT;
50 | typedef unsigned int UINT;
51 |
52 | /* This type MUST be 8-bit */
53 | typedef unsigned char BYTE;
54 |
55 | /* These types MUST be 16-bit */
56 | typedef short SHORT;
57 | typedef unsigned short WORD;
58 | typedef unsigned short WCHAR;
59 |
60 | /* These types MUST be 32-bit */
61 | typedef long LONG;
62 | typedef unsigned long DWORD;
63 |
64 | /* This type MUST be 64-bit (Remove this for ANSI C (C89) compatibility) */
65 | typedef unsigned long long QWORD;
66 |
67 | typedef char TCHAR;
68 | #define _T(x) x
69 | #define _TEXT(x) x
70 |
71 | typedef DWORD FSIZE_t;
72 |
73 | typedef struct __FATFS FATFS;
74 |
75 |
76 | typedef struct {
77 | FATFS* fs;
78 | WORD id;
79 | BYTE attr;
80 | BYTE stat;
81 | DWORD sclust;
82 | FSIZE_t objsize;
83 | UINT lockid;
84 | } _FDID;
85 |
86 | typedef struct {
87 | _FDID obj;
88 | BYTE flag;
89 | BYTE err;
90 | FSIZE_t fptr;
91 | DWORD clust;
92 | DWORD sect;
93 | DWORD dir_sect;
94 | BYTE* dir_ptr;
95 | DWORD* cltbl;
96 | BYTE buf[512];
97 | } FIL;
98 |
99 |
100 | /* File access mode and open method flags (3rd argument of f_open) */
101 | #define FA_READ 0x01
102 | #define FA_WRITE 0x02
103 | #define FA_OPEN_EXISTING 0x00
104 | #define FA_CREATE_NEW 0x04
105 | #define FA_CREATE_ALWAYS 0x08
106 | #define FA_OPEN_ALWAYS 0x10
107 | #define FA_OPEN_APPEND 0x30
108 |
109 |
110 |
111 | /* File function return code (FRESULT) */
112 |
113 | typedef enum {
114 | FR_OK = 0, /* (0) Succeeded */
115 | FR_DISK_ERR, /* (1) A hard error occurred in the low level disk I/O layer */
116 | FR_INT_ERR, /* (2) Assertion failed */
117 | FR_NOT_READY, /* (3) The physical drive cannot work */
118 | FR_NO_FILE, /* (4) Could not find the file */
119 | FR_NO_PATH, /* (5) Could not find the path */
120 | FR_INVALID_NAME, /* (6) The path name format is invalid */
121 | FR_DENIED, /* (7) Access denied due to prohibited access or directory full */
122 | FR_EXIST, /* (8) Access denied due to prohibited access */
123 | FR_INVALID_OBJECT, /* (9) The file/directory object is invalid */
124 | FR_WRITE_PROTECTED, /* (10) The physical drive is write protected */
125 | FR_INVALID_DRIVE, /* (11) The logical drive number is invalid */
126 | FR_NOT_ENABLED, /* (12) The volume has no work area */
127 | FR_NO_FILESYSTEM, /* (13) There is no valid FAT volume */
128 | FR_MKFS_ABORTED, /* (14) The f_mkfs() aborted due to any problem */
129 | FR_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */
130 | FR_LOCKED, /* (16) The operation is rejected according to the file sharing policy */
131 | FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */
132 | FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > _FS_LOCK */
133 | FR_INVALID_PARAMETER /* (19) Given parameter is invalid */
134 | } FRESULT;
135 |
136 |
137 |
138 | FRESULT f_open (FIL* fp, const TCHAR* path, BYTE mode); /* Open or create a file */
139 | FRESULT f_close (FIL* fp); /* Close an open file object */
140 | FRESULT f_read (FIL* fp, void* buff, UINT btr, UINT* br); /* Read data from the file */
141 | FRESULT f_write (FIL* fp, const void* buff, UINT btw, UINT* bw); /* Write data to the file */
142 | FRESULT f_lseek (FIL* fp, FSIZE_t ofs); /* Move file pointer of the file object */
143 | FRESULT f_rename (const TCHAR* path_old, const TCHAR* path_new); /* Rename/Move a file or directory */
144 | FRESULT f_unlink (const TCHAR* path); /* Delete an existing file or directory */
145 |
146 | #define f_size(fp) ((fp)->obj.objsize)
147 | #define f_tell(fp) ((fp)->fptr)
148 | #define f_eof(fp) ((int)((fp)->fptr == (fp)->obj.objsize))
149 |
150 | #ifndef EOF
151 | #define EOF (-1)
152 | #endif
153 |
154 | #endif
155 |
--------------------------------------------------------------------------------
/help/sdkdemo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Quick Reference Guide
6 |
7 |
15 |
16 |
17 |
SDK Demo Quick Reference Guide
18 |
19 | Example help file
20 |
21 |
Navigation
22 | Press + to move one line forward
23 | Press - to move one line backward
24 | Press × to move one page forward
25 | Press ÷ to move one page backward
26 |
27 |
28 |
29 |
Symbols used in this guide
30 | A 123 represents a soft button or anything on the LCD
31 | A STO represents a physical button
32 |
33 |
47 | The DMCP system supports extremely lightweight implementation of HTML which covers just
48 | small fraction of the format. Almost all supported formatting is used in this help file.
49 |
50 | If you want to write your own help file it is strongly recommended to take this help file
51 | as starting point and follow the structure of the HTML. Then check the appearance in
52 | calculator browser, whether it looks as expected.
53 |
54 | See "Special characters available" for list of supported
55 | characters in help file.
56 |
57 |
58 |
59 |
Stack
60 | Stack consists of 10 registers. All arithmetic operations use for arguments and results
61 | top level of the stack as is usual for RPN machines.
62 | Stack registers could be also accessed using
63 | RCL and STO
64 | with negative indexes -1 to -9.
65 |
66 | Example of stack display:
67 | 6: 0
68 | 5: 0
69 | 4: 0
70 | 3: 0
71 | 2: 321232.123ᴇ-12
72 | 1: 54.344234342
73 | 0: 123.32
74 |
75 |
76 |
Registers
77 | Register area consist of 100 registers. Registers could be accessed using
78 | RCL and STO
79 | with indexes 0 to 99.
80 |
81 |
82 |
83 |