Writing Cortex-M4 registers in nor flash driver

I would like to write some core registers from within a nor flash driver for a Cortex-M4 device that I’m trying to add to OpenOCD.

It seems the common way to do this is by using the “target_run_algorithm()” command. However, I am not using that command and would just like to simply write the core regs. What functions/structures etc. do I have available to me from within this context to accomplish this?

For example I found the api “cortex_m_store_core_reg_u32()”, however this api is not exposed.

Any ideas!?