meta data for this page
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
programming:c:ceedling [2021/04/22 11:03] – created niziak | programming:c:ceedling [2021/04/22 16:55] (current) – niziak | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Ceedling ====== | ====== Ceedling ====== | ||
* **support files ** - additional C files needed for tests but not for project (not added to project src). | * **support files ** - additional C files needed for tests but not for project (not added to project src). | ||
- | | + | |
+ | ====== Hints ====== | ||
+ | | ||
+ | * Make separate '' | ||
+ | * Try to create separate '' | ||
+ | * Always wrap HAL or other lower parts using some thin wrappers | ||
===== add .c file ===== | ===== add .c file ===== | ||
- | When ceedling fails to pickup automatically .c file it can be added to given test by | + | When '' |
<code c> | <code c> | ||
TEST_FILE(" | TEST_FILE(" | ||
</ | </ | ||
+ | |||
+ | ===== cross includes = deep linking ===== | ||
+ | |||
+ | Also '' | ||
+ | All dependent includes needs to be added manually in test '' | ||
+ | |||
+ | This is desired behavior because '' | ||
+ | Perhaps you should break dependency chain by including mocked header. | ||
+ | |||
+ | <code c> | ||
+ | # This will include 20 another headers :) | ||
+ | |||
+ | #include " | ||
+ | |||
+ | # To prevent this: | ||
+ | #include " | ||
+ | </ | ||
+ | |||
+ | ===== common includes ===== | ||
+ | <code yaml> | ||
+ | :cmock: | ||
+ | :includes: | ||
+ | - < | ||
+ | - < | ||
+ | </ | ||
+ | |||
+ | ===== extern keyword ===== | ||
+ | < | ||
+ | WARNING: No function prototypes found! | ||
+ | </ | ||
+ | By default '' | ||
+ | <code yaml> | ||
+ | :cmock: | ||
+ | : | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== volatile function parameters ===== | ||
+ | <code c> | ||
+ | void myfn(custom_t *m, volatile uint32_t *var); | ||
+ | |||
+ | error: conflicting types for ... | ||
+ | </ | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | The C99 standard recommends against using volatile as function call parameters and as return values, | ||
+ | stating that it is undefined behavior (because it is implementation- | ||
+ | not be depended upon. | ||
+ | |||
+ | * **Workaround1: | ||
+ | * **Workaround2: | ||