This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

HalCodeGen: Regenerating code

Other Parts Discussed in Thread: HALCOGEN

If I configure my chip, RM48L952ZWT in my case, graphically using HAL Code Generator and then generate the code, what happens if I need to make a change? Does generating the code again overwrite the existing code except what is in the user blocks?

If I were to later disable a module, does that nicely remove the module or does that perpetually stay in the code? I presume subsequently enabling a module adds code.

  • Your understanding is correct. You must only have your custom code inside the USER CODE BEGIN section or they will be overwritten by HalCoGen. Anything outside of the USER CODE sections will be removed the next time you regenerate the code.

    I'm not too clear what you meant by disabling the module. Let's say you enable GIO in the HalCoGen driver tab. You will now see gio.c file being generated. If you call gioInit() then the GIO registers are initialized. Of course if you want to use the GIO module such as setting a GIO pin high or low your application needs to write it. Later on if you decide that you no longer need the GIO module you might remove the gioInit() and any code or API that you might have invoked to affect the GIO functionality. In this case, the gio.c file will still remain in the folder but it has no effect on your code size.
  • Hi Sarah,
    Is your question answered here? If your question is answered can you please click the 'Verify Answer' button to close the thread? Thanks.