MbedTLS RSA gen key calloc failing and hardfault

@dhavalhparikh26
Note that key size of 512 is very unsecure.
Have you considered using ECC keys instead?

It seems you have low memory issuers.
Is it only heap problem, or RAM?

Could this post help you?

In addition, You could read this article to see ways to reduce RAM usage.