KSDK MMCAU cau_api.h

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

KSDK MMCAU cau_api.h

965 Views
audi_mcavoy
Contributor IV

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

Labels (1)
Tags (2)
0 Kudos
2 Replies

447 Views
ivadorazinova
NXP Employee
NXP Employee

Hi Audi,

The comment in cau_api.h is wrong, cau_md5_initialize_output() needs 16 bytes. It will be fixed for SDK 2.0.

The same bug is in http://cache.freescale.com/files/32bit/doc/user_guide/CAUAPIUG.pdf

The documentation is wrong, but the AN4307SW example is correctly using 16 bytes.

Thank you,

Best Regards,

Iva

447 Views
ivadorazinova
NXP Employee
NXP Employee

Hello Audi,

thank you for your feedback.

I reproduced to SW Development Team.

Best Regards,

Iva

0 Kudos