I use cmocka with FreeRTOS on an ARM Cortex-M3. I'm currently on version 1.1.1 of cmocka, newer versions may have different configuration needs. My stack is usually 16KiB, so you shouldn't be running into any trouble with a 64KiB stack unless you have written some tests that require a huge stack.
The configuration really depends more on what C library you are using and less on your operating system. I have two projects using FreeRTOS with cmocka but one uses a cut-down version of MUSL for its C library and another uses a proprietary C library.
Here's how I configured my project using MUSL...
MUSL has signal.h
and I have implemented some time functionality so my config.h
ended up looking like this:
#ifndef CMOCKA_CONFIG_H_
#define CMOCKA_CONFIG_H_
#define HAVE_SIGNAL_H
#define HAVE_CLOCK_GETTIME_REALTIME
#define HAVE_STRUCT_TIMESPEC
#define CMOCKA_PLATFORM_INCLUDE
#endif /* CMOCKA_CONFIG_H_ */
I created the following C file which I named cmocka_platform.c
to satisfy some cmocka C library dependencies that weren't implemented in my cut-down version of MUSL, notice I just have the signal function just return NULL:
#include <stdlib.h>
#include <stdio.h>
FILE *const stdin = NULL;
FILE *const stdout = NULL;
FILE *const stderr = NULL;
void (*signal(int sig, void (*func)(int)))(int) {
return NULL;
}
In my cmocka_platform.h
I have the following:
#include <stdlib.h>
#include <stdio.h>
#include <setjmp.h>
#include <stddef.h>
#define CMOCKA_ENABLED
#define exit(status) while(1)
#define abort() while(1)
#define getenv(env) NULL
#define fputs(str, stream) my_printf(MYLOG_LEVEL_D, str)
#define fflush(stream)
#define fopen(stream, mode) NULL
#define fclose(stream)
#define fprintf(stream, format, ...) my_printf(MYLOG_LEVEL_D, format, ##__VA_ARGS__)
#define printf(format, ...) my_printf(MYLOG_LEVEL_D, format, ##__VA_ARGS__)
I found an open source implementation of setjmp and longjmp from newlib project that ican easily be modified to be self contained. Here is a link: https://sourceware.org/git/?p=newlib-cygwin.git;a=blob_plain;f=newlib/libc/machine/arm/setjmp.S;h=21d6ff9e7ff3762536eddcd317ae4da6e6ba64a2;hb=refs/heads/master