2024-09-03 09:26 AM - last edited on 2024-09-03 09:31 AM by Andrew Neil
Solved! Go to Solution.
2024-09-04 02:33 PM
Looks like the CDC is using a lot of RAM. If you change the buffer from 1024 to 512, then it will fit.
2024-09-03 09:30 AM - edited 2024-09-03 09:32 AM
What optimisation setting are you using?
Are there configuration options on the library to reduce its memory footprint (presumably, at the cost of functionality and/or performance)?
2024-09-03 10:47 AM - edited 2024-09-03 10:48 AM
You need only 12 bytes to fit. Try to optimize. Section .data is initialized data copied to flash. Is there a large array or struct mostly filled with zeros?
2024-09-03 12:00 PM
I have a project that uses the USB CDC code, CAN drivers, along with my code and the code fits just fine. You didn't mention what YOUR code is doing that is generating code larger than the flash memory.
What you should have done was use a larger flash memory and write your code first. Then you can determine if you can go with a lower memory chip afterwards.
You can look into the STM32F072 with more flash memory, which I believe is a drop in replacement.
2024-09-03 01:26 PM
@Andrew Neil : What optimisation setting are you using?
I did not change anything in the default settings, but I will have a look on it. Thank you!
@Andrew Neil :Are there configuration options on the library to reduce its memory footprint (presumably, at the cost of functionality and/or performance)?
I changed the size of some buffers, but I doesnt work.
@Pavel A. You need only 12 bytes to fit.
Yes, but I have not a single line of user code in this configuration. I think I can optimize the 12 byte, but then I still have no space for my user code.
@Karl Yamashita I have a project that uses the USB CDC code
With the F042K6 (LQPF32, 32K Flash, 8K RAM and only CAN OR USB, both is not possible on this device)?
@Karl Yamashita You can look into the STM32F072 with more flash memory,
Not available in LQPF32.... next LQPF32 is F303 but it requiere a crystal for usb.
Thanks for your answers!
2024-09-03 01:50 PM
The STM32F042C6 has the same flash memory size as the K6.
Can you upload your IOC file?
2024-09-03 11:19 PM
2024-09-04 02:55 AM
@PP11 wrote:@Andrew Neil : What optimisation setting are you using?
I did not change anything in the default settings,
Then likely it's NO optimisation - so definitely start by adjusting that!
And a big +1 to @Karl Yamashita's suggestion to start developing on a bigger device - it's far easier to find optimisations in something that does build than in something that doesn't.
When it does build, you will have a map file to look at to see where all the code space is going.
@PP11 wrote:I changed the size of some buffers, but I doesn't work.
Buffers would be in RAM - so unlikely to affect Flash use.
2024-09-04 02:33 PM
Looks like the CDC is using a lot of RAM. If you change the buffer from 1024 to 512, then it will fit.
2024-09-09 05:47 AM
Hey Karl,
the optimization settings and lowering the buffer size does work, thanks for your help!
Greetings Paul