You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(Documentation): Update for merge with main and address review feedback
Theme and Dependencies:
- Update adi-mkdocs-harmonic to v0.7.1 (latest stable release)
- Update pymdown-extensions requirement for compatibility
Content Updates:
- Add Unity Test Framework documentation to libraries.md
- Ported from PR #1033 which was merged to main after original PR #1257
- Includes on-target testing and host machine testing examples
- Documents test build target and FreeRTOS integration
Link Fixes:
- Fix broken anchor link in libraries.md (visual-studio-code.md reference)
- Fix relative path in CONTRIBUTING.md (user-guide/index.md)
- Change from Documentation/user-guide/index.md to user-guide/index.md
(path is relative to Documentation folder after build.py copies it)
Address Original PR #1257 Review Feedback:
- Remove redundant 'typical' wording in getting-started.md development cycle
- Changed 'The typical development cycle typically' to 'The development cycle typically'
- Update Windows support from 'Windows 10 only' to 'Windows 10 and later'
- Reflects current MSDK Windows 11 compatibility
- Remove proprietary licensing statement from mkdocs.yml copyright line
- Deleted 'This software is proprietary to Analog Devices, Inc. and its licensors.'
- Aligns with MSDK's permissive licensing
Cleanup:
- Remove accidentally committed .DS_Store files (macOS system files)
These changes ensure the resurrected PR builds cleanly, includes content
added to main since Nov 2024, and addresses all review feedback from the
original PR.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -257,7 +257,7 @@ DoxyGen is automatically run across the MSDK code as part of the User Guide's bu
257
257
258
258
### User Guide
259
259
260
-
The [MSDK User Guide](Documentation/user-guide/index.md) is maintained in the `Documentation/user-guide` folder. This document contains higher-level usage info for the MSDK. If a part, IDE, or library is supported by the MSDK then there should be some relevant info in the User Guide covering its setup, configuration, and usage.
260
+
The [MSDK User Guide](user-guide/index.md) is maintained in the `Documentation/user-guide` folder. This document contains higher-level usage info for the MSDK. If a part, IDE, or library is supported by the MSDK then there should be some relevant info in the User Guide covering its setup, configuration, and usage.
261
261
262
262
When writing markdown links, relative paths should always be used. Additionally, links to local files on the user's filesystem **cannot** be used, since the online copy of the docs will throw a 404 on them. See [Writing Your Docs](https://www.mkdocs.org/user-guide/writing-your-docs/) for more details.
Copy file name to clipboardExpand all lines: Documentation/user-guide/getting-started.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,5 @@
1
1
# Getting Started
2
-
3
-
The MSDK is designed for both evaluation and end-application development. The typical **evaluation** cycle usually involves setting up the development environment, running demos, and exercising the peripheral driver API on an _evaluation platform_. The typical **development** cycle typically involves building a prototype application on an _evaluation platform_ first, then porting the application to a custom board. This section describes how to get started with the MSDK focusing on the _evaluation_ cycle.
2
+
The MSDK is designed for both evaluation and end-application development. The typical **evaluation** cycle usually involves setting up the development environment, running demos, and exercising the peripheral driver API on an _evaluation platform_. The **development** cycle typically involves building a prototype application on an _evaluation platform_ first, then porting the application to a custom board. This section describes how to get started with the MSDK focusing on the _evaluation_ cycle.
4
3
5
4
**First**, review the [**Key Concepts**](#key-concepts) below. Then proceed to the section for your preferred IDE. Each subsection is a self-contained quick-start that includes links to additional documentation on important topics.
Copy file name to clipboardExpand all lines: Documentation/user-guide/libraries.md
+135Lines changed: 135 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -242,3 +242,138 @@ All parts in the MSDK support the Coremark library via a `Coremark` example appl
242
242
243
243
???+ note "ℹ️ **Note**"
244
244
The source code of the `Coremark` examples are somewhat unique. They only contain a `core_portme.c`/`core_portme.h`. These files are provided by CoreMark libraries to give the MSDK an implementation layer for a few hardware-dependent functions. Otherwise, the remainder of the source code (located in `Libraries/Coremark`) must remain unmodified to comply with the CoreMark rules.
245
+
246
+
## Unity Test Framework
247
+
248
+
The [Unity Test Project](https://github.com/ThrowTheSwitch/Unity) is a simple unit testing framework for C. It can be used to run hardware-in-the-loop tests on MSDK microcontrollers, as well as more individual unit tests compiled and run on a developer's host machine to test less hardware-dependent software abstractions.
249
+
250
+
See [Build Variables for Toggling Libraries](build-system.md#build-variables-for-toggling-libraries) for instructions on enabling the Unity Test framework.
251
+
252
+
### Unity Test Supported Parts
253
+
254
+
- All
255
+
256
+
### Running Tests on a Target Micro
257
+
258
+
The following code snippet shows how a simple sequence of tests might be run on a target microcontroller using the Unity test library. Once unity is [enabled](build-system.md#build-variables-for-toggling-libraries), including the `"unity.h"` header file grants access to useful assertions and macros. The project can then be [built and run](visual-studio-code.md#flash-run) like any other MSDK project.
The results of the test will be sent to the microcontroller's serial console output (defined by `CONSOLE_UART` in the [BSP](board-support-pkgs.md)), and can be viewed from a serial terminal.
279
+
280
+
```serial
281
+
-----------------------
282
+
2 Tests 0 Failures 0 Ignored
283
+
OK
284
+
```
285
+
286
+
For a more comprehensive list of available assertions see the [Unity Assertions Documentation](https://github.com/ThrowTheSwitch/Unity/blob/master/docs/UnityAssertionsReference.md).
287
+
288
+
### Running Tests on a Host Machine
289
+
290
+
When the Unity Test framework is enabled, a new build target `test` becomes available. When `make test` is run, it compiles the source code in the `test` sub-folder of the current project into a single binary that will run on the developer's host PC. The test results are printed to the screen and a non-zero return code is passed to the host process in the case of any failures. Currently, the tools are set up to do this with GCC.
291
+
292
+
This is useful for developing unit-level testing for more abstract software.
293
+
294
+
For example, assume there is a simple function for adding two `uint8_t` in the current project that we would like to unit test.
295
+
296
+
```C
297
+
// simple_code.c
298
+
#include<stdint.h>
299
+
300
+
uint8_tsimple_add(uint8_t x, uint8_t y)
301
+
{
302
+
return x + y;
303
+
}
304
+
```
305
+
306
+
In the `test` folder of our project, we can implement the following tests in a file called `test_functions.c`
307
+
308
+
```C
309
+
// test/test_functions.c
310
+
#include <stdint.h>
311
+
#include "unity.h"
312
+
313
+
// Adding an 'extern' declaration of the function to test gets this file access to it
314
+
extern uint8_t simple_add(uint8_t x, uint8_t y);
315
+
316
+
// Utility functions for unit testing setup/clean-up. Empty for this simple example.
317
+
void setUp(void) {}
318
+
void tearDown(void) {}
319
+
320
+
// Validate that 'simple_add' 3+4 == 7
321
+
void test_simple_add_ok(void)
322
+
{
323
+
TEST_ASSERT_EQUAL(7, simple_add(3, 4));
324
+
}
325
+
326
+
// Check if 'simple_add' 3+4 == -1
327
+
// In this case, we expect this to fail since we are using uint8_t
328
+
void test_simple_add_fail(void)
329
+
{
330
+
TEST_ASSERT_EQUAL(-1, simple_add(3, -4));
331
+
}
332
+
```
333
+
334
+
A top-level `main` function for driving these test functions also needs to be written. Unity features scripts for generating these top-level functions automagically (see the [Unity Helper Scripts Guide](https://github.com/ThrowTheSwitch/Unity/blob/master/docs/UnityHelperScriptsGuide.md)), or they can be written manually. For this example, the output of the helper script looks as follows and is saved to the `test/test_runner.c` file.
335
+
336
+
```C
337
+
// test/test_runner.c
338
+
// Test runner code
339
+
// Header files
340
+
#include"unity.h"
341
+
342
+
// Test functions
343
+
externvoidtest_simple_add_ok(void);
344
+
extern void test_simple_add_fail(void);
345
+
346
+
// Main function
347
+
int main(void)
348
+
{
349
+
UnityBegin(__FILE__);
350
+
351
+
RUN_TEST(test_simple_add_ok);
352
+
RUN_TEST(test_simple_add_fail);
353
+
354
+
return (UnityEnd());
355
+
}
356
+
```
357
+
358
+
The test plan above can then be run on the developer's host PC with:
359
+
360
+
```console
361
+
$ make test
362
+
363
+
>> host pc gcc output here <<
364
+
365
+
running tests...
366
+
test/test_runner.c:12:test_simple_add_ok:PASS
367
+
test/test_runner.c:13:test_simple_add_fail:FAIL: Expected -1 Was 255
368
+
369
+
-----------------------
370
+
2 Tests 1 Failures 0 Ignored
371
+
FAIL
372
+
373
+
>> ...and returns error code <<
374
+
```
375
+
376
+
Notice that the test returned a failure code as we expected (since the second test was intentionally broken to illustrate a unit test failure).
377
+
378
+
???+ note "ℹ️ **Note**"
379
+
The test feature requires an OS-layer abstraction that provides functions like `malloc` and `free`. By default, the test feature will attempt to use the [FreeRTOS](#freertos) OS layer if it's available. Otherwise, it will use NewLib's implementation. Custom OS layers can be implemented, but are currently outside the scope of this document.
Copy file name to clipboardExpand all lines: mkdocs.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
site_name: Analog Devices MSDK Documentation
2
2
site_author: Analog Devices, Inc.
3
-
copyright: 'Copyright (C) 2022-2023 Maxim Integrated Products, Inc. All Rights Reserved. (now owned by Analog Devices, Inc.), Copyright (C) 2023-2024 Analog Devices, Inc. All Rights Reserved. This software is proprietary to Analog Devices, Inc. and its licensors.'
3
+
copyright: 'Copyright (C) 2022-2023 Maxim Integrated Products, Inc. All Rights Reserved. (now owned by Analog Devices, Inc.), Copyright (C) 2023-2024 Analog Devices, Inc. All Rights Reserved.'
0 commit comments