Skip to main content
AHuss.3
Associate
May 26, 2021
Solved

What tool or script is used to generate the following code and how it's done? I need to generate similarly for STM32H7 series

  • May 26, 2021
  • 5 replies
  • 1646 views

// STM32F407VG, STM32F407ZG, STM32F405RG

// DO NOT EDIT! Automatically generated!

static void stm32f40x_usart_create_objects(Object *obj, JSON_Object *svd,

       const char *name)

{

   STM32USARTState *state = STM32_USART_STATE(obj);

   JSON_Object *periph = svd_get_peripheral_by_name(svd, name);

   svd_add_peripheral_properties_and_children(obj, periph, svd);

   // Registers.

   state->u.f4.reg.sr = cm_object_get_child_by_name(obj, "SR");

   state->u.f4.reg.dr = cm_object_get_child_by_name(obj, "DR");

   state->u.f4.reg.brr = cm_object_get_child_by_name(obj, "BRR");

   state->u.f4.reg.cr1 = cm_object_get_child_by_name(obj, "CR1");

   state->u.f4.reg.cr2 = cm_object_get_child_by_name(obj, "CR2");

   state->u.f4.reg.cr3 = cm_object_get_child_by_name(obj, "CR3");

   state->u.f4.reg.gtpr = cm_object_get_child_by_name(obj, "GTPR");

   // SR bitfields.

   state->u.f4.fld.sr.pe = cm_object_get_child_by_name(state->u.f4.reg.sr,

           "PE");

   state->u.f4.fld.sr.fe = cm_object_get_child_by_name(state->u.f4.reg.sr,

           "FE");

   state->u.f4.fld.sr.nf = cm_object_get_child_by_name(state->u.f4.reg.sr,

           "NF");

   state->u.f4.fld.sr.ore = cm_object_get_child_by_name(state->u.f4.reg.sr,

           "ORE");

   state->u.f4.fld.sr.idle = cm_object_get_child_by_name(state->u.f4.reg.sr,

           "IDLE");

   state->u.f4.fld.sr.rxne = cm_object_get_child_by_name(state->u.f4.reg.sr,

           "RXNE");

   state->u.f4.fld.sr.tc = cm_object_get_child_by_name(state->u.f4.reg.sr,

           "TC");

   state->u.f4.fld.sr.txe = cm_object_get_child_by_name(state->u.f4.reg.sr,

           "TXE");

   state->u.f4.fld.sr.lbd = cm_object_get_child_by_name(state->u.f4.reg.sr,

           "LBD");

   state->u.f4.fld.sr.cts = cm_object_get_child_by_name(state->u.f4.reg.sr,

           "CTS");

.....

....

....

...

...

   // GTPR bitfields.

   state->u.f4.fld.gtpr.psc = cm_object_get_child_by_name(state->u.f4.reg.gtpr,

           "PSC");

   state->u.f4.fld.gtpr.gt = cm_object_get_child_by_name(state->u.f4.reg.gtpr,

           "GT");

}

This topic has been closed for replies.
Best answer by Tesla DeLorean

https://github.com/xpack/xsvd-js

5 replies

Tesla DeLorean
Guru
May 26, 2021

Perhaps QEMU

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
AHuss.3
AHuss.3Author
Associate
May 26, 2021

@Community member​ 

Thanks for the response.

Could you please let me know how it's done? I am a newbie to QEMU and I couldn't find any support for the same

Tesla DeLorean
Guru
May 26, 2021

Looks to be an SVD to JSON conversion tool, if it is not shared publicly then you'll need to talk with the developers

https://xpack.github.io/qemu-arm/

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
AHuss.3
AHuss.3Author
Associate
May 26, 2021

@Community member​ 

Thank you! That was helpful