I have the same goal - NVM in Simulink with C function calls. Attached is a zip file of my progress with Simulink calling C code (per the S32DS Fee example):

Perhaps someone can help me see why the values I attempt to write do not present in my Fee read function (I'm trying to read them in FreeMaster). (I did my work in the initialize block to limit my NVM cycles):

FreeMaster:

The Return_Write and Return_Read return a value of zero (happy), but my ReadNVM returns my default value off 0xAAFF, not the expected values per: "DataBlock0 = uint8([0x00, 0x01, 0x02, 0x03]);"
I don't want to hijack the thread, but I think we're on the same path... A little help with my code and we'll all be happy?