Audi McAvoy

KSDK MMCAU cau_api.h

Discussion created by Audi McAvoy on Sep 23, 2015
Latest reply on Sep 25, 2015 by Iva Susnova

I found cau_api.h in my KSDK 1.2.0 directory.  Here's the comments at the top of the file.

 

/*

*  CAU Header File

*  Works with library cau_lib.a and lib_mmcau*.a

*  Define FREESCALE_CAU if CAU coprocessor is used --Register parameter passing is assumed

*  Define FREESCALE_MMCAU if mmCAU coprocessor is used --EABI for Kinetis ARM Cortex-Mx

*  12/19/2013

*/

 

So I #define FREESCALE_MMCAU (as specified in section 3.2, page 6 of "ColdFire/ColdFire+ CAU and Kinetis mmCAU Software Libary User Guide" Rev 2.3) and #include "cau_api.h" in a K64F test project (I also added the path to my compiler includes and the library to my linker).  I created an unsigned char md5_state[15] variable in main(), and called cau_md5_initialize_output(md5_state).

 

Next, using KDS 3.0.0, I hit Build Project.

 

Then I sat here dumbfounded, staring at an error message telling me that I have an "#if with no expression."  Of course it's the very first non-comment line in cau_api.h, which reads. . .

#if FREESCALE_MMCAU

 

I have to change this to #ifdef FREESCALE_MMCAU for the project to compile.

 

By itself, it wasn't enough to compel me to write this rant, I mean post.  I was irritated that I found yet another library/example/tutorial that doesn't work.  But, I understand that KDS/KSDK isn't a trivial suite of tools.

 

It was when I looked at the description of the next function I was interested in, cau_md5_hash(), and noticed a discrepancy in the size of the required md_state variable.  cau_md5_initialize_output() calls for 120 bits (notice I used a 15 byte array earlier).  cau_md5_hash() calls for 128 bits.  The other two md5 functions, and Google, confirms that I should have declared a 16 byte array of storage.

 

THAT's when I had enough to post this message.

 

To whomever maintains this library, please address these issues before the next release.  Hopefully it will save someone else some grief.

- Audi

Outcomes