meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
programming:c:ceedling [2021/04/22 12:29] niziakprogramming: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 ====== 
 +  Orgranize code into very small functional modules. 
 +  * Make separate ''.h'' for each ''.c'' module. 
 +  * Try to create separate ''.h'' for types and separate for function prototypes (it helps later with mocking) 
 +  * Always wrap HAL or other lower parts using some thin wrappers 
 ===== add .c file  ===== ===== add .c file  =====
  
Line 24: Line 30:
 # To prevent this: # To prevent this:
 #include "mock_cpu_hal.h #include "mock_cpu_hal.h
 +</code>
 +
 +===== common includes =====
 +<code yaml>
 +:cmock:
 +  :includes:
 +    - <stdbool.h>
 +    - <stdint.h>
 </code> </code>
  
Line 38: Line 52:
  
 ===== volatile function parameters ===== ===== volatile function parameters =====
-<code>+<code c> 
 +void myfn(custom_t *m, volatile uint32_t *var); 
 error: conflicting types for ... error: conflicting types for ...
 </code> </code>
Line 48: Line 64:
   not be depended upon.   not be depended upon.
  
- +  * **Workaround1:** is to use macro for volatile and redefine it to nothing when ''TEST''. 
- +  * **Workaround2:** is to use ''typedef volatile uint32_t my_volatile_type;''