I developed firmware for STM32F072 and it implements composite USB and uses some peripherals such as ADC and DMA, TIM1 and I2C. I can generate HEX and load it into MCU and device is ready for the client. All fine.
Well my client expressed wish to do some manual development on their own in just particular part of my device. Some customised filtering of ADC data to be more specific.
I don't really want to expose my code although it's not really a rocket science but it's my intelectual property and I put effort, time and resources into it. So I got two ideas.
1. Create library (*.lib) for them so they can use library and add some of their functionality without touching/seeing my code. I did that and I succesfully created *.lib.
I exported two main functions to use... one is Init() other is Processing(). So the client can put into their project into their main() something like this...
int Callback1(uint8_t * data, uint32_t length)
// client do some stuff here
int Callback2(uint8_t * data, uint32_t length)
// client do some stuff here
I tried it and at first it didn't work so I found out that there are missing _IRQ handlers... so I made a wrapper that redirects IRQ handlers called from user code into handlers in my library.
Well this works... almost... USB device is enumerating and descriptors are transfered ok except string descriptors. I used Thesycon USB descriptor dumper and I can see there is error code for string descriptors. All other descriptors (Device, Interface, Configuration etc... are fine and properly set)
String Descriptor Table
Index LANGID String
0x01 0x0000 Request failed with 0x0000001F
0x02 0x0000 Request failed with 0x0000001F
0x03 0x0000 Request failed with 0x0000001F
0x04 0x0000 Request failed with 0x0000001F
0x05 0x0000 Request failed with 0x0000001F
0x06 0x0000 Request failed with 0x0000001F
0x07 0x0000 Request failed with 0x0000001F
To sumarize... Client calls SystemInit in Clients project to setup clocks, then Init from library to setup peripheral. I also made wrappers for ADC, USB and DMA IRQ handlers so client handlers call code from handlers in my lib. So my question is if is there something else I am missing? I just don't understand why USB enumerates fine but it's unable to get string descriptors. I
2. HEX file - similar to Nordic's softdevice - I haven't tried this yet but it looks a little bit more complex to make. The ideaa is that I provide hex file of my firmware and client creates their own project which is then loaded into specified region of flash and uses specified region of ram. However there needs to be done some kind of communication between both using __SVC calls or similar etc... Does anybody has an experiences with this? Well I already have two hexes on device... one is custom bootloader and second one is application FW... so I have some experiences with loading addresses from memory and executing code from application FW.... but not in a way that softdevice use...
Thank you for the answers and any help is much appreciated!
p.s. I am using HAL drivers.