cancel
Showing results for 
Search instead for 
Did you mean: 

Generating Wrong configuration while generating code from cubeMx.

Mayank1
Associate II

Hi there,

While generating code for TouchGFX, it is re-generating files with wrong configuration and over writing generated files, which gives compilation error. In order to compile successfully, those files need to discard.

these files are TouchGFXGeneratedHAL.cpp and TouchGFXConfiguration.cpp.

Is there any workaround for this ? so that it doesn't regenerate

4 REPLIES 4
Romain DIELEMAN
ST Employee

Hi,

Is your project based on an application template available in TouchGFX Designer for one of the ST development kit ? Could you explain what are the wrong configuration generated ? Could you share a screenshot of your TouchGFX configuration in STM32CubeMX ?

/Romain

Mayank1
Associate II

No, actually its for a custom board. Generated code using CubeMX using Partial frame buffer strategy. TouchGFXGeneratedHAL.cpp contains some methods which are used before they have been defined. and re-arranging the correct sequence is not beneficial as it over writes the whole file, every time I generate code from CubeMX. Below are the methods.

/* ******************************************************

 * Functions required by Partial Frame Buffer Strategy

 * ******************************************************

 *

 * * uint8_t isTransmittingData() must return whether or not data is currently being transmitted, over e.g. SPI.

 * * void transmitFrameBufferBlock(uint8_t* pixels, uint16_t x, uint16_t y, uint16_t w, uint16_t h) will be called

 *    when the framework wants to send a block. The user must then transfer

 *    the data represented by the arguments.

 *

 * A user must call touchgfx::startNewTransfer(); once transmitFrameBufferBlock() has succesfully sent a block.

 * E.g. if using DMA to transfer the block, this could be called in the "Transfer Completed" interrupt handler.

 *

 */

extern "C" void transmitFrameBufferBlock(uint8_t* pixels, uint16_t x, uint16_t y, uint16_t w, uint16_t h);

extern "C" uint8_t isTransmittingData();

// Block Allocator for Partial Framebuffer strategy

ManyBlockAllocator<512, /* block size */

          3, /* number of blocks */

          2 /* bytes per pixel */

          > blockAllocator;

// Used by Partial Framebuffer strategy to indicate that a new block is ready for transfer.

static volatile bool readyForTransfer = false;

namespace touchgfx

{

/**

 * This functino is called by FrameBufferAllocator if no block is

 * available.

 */

void FrameBufferAllocatorWaitOnTransfer()

{

 while(!readyForTransfer);

}

/**

 * Called by FrameBufferAllocator when a block is drawn and

 * therefore ready for transfer. The LCD driver should use this

 * method to start a transfer.

 */

void FrameBufferAllocatorSignalBlockDrawn()

{

  readyForTransfer = false;

  return;

}

// A user must call touchgfx::startNewTransfer(); once transmitFrameBufferBlock() has succesfully sent a block.

void startNewTransfer()

{

  FrameBufferAllocator* fba = HAL::getInstance()->getFrameBufferAllocator();

  fba->freeBlockAfterTransfer();

  readyForTransfer = true;

  if (fba->hasBlockReadyForTransfer())

  {

    touchgfx::Rect r;

    const uint8_t* pixels = fba->getBlockForTransfer(r);

    transmitFrameBufferBlock((uint8_t*)pixels, r.x, r.y, r.width, r.height);

  }

}

}

Hi,

If i understand correctly you are working in the TouchGFXGeneratedHAL files ? If yes then it makes sense that your changes are overwritten at every code generation. You should add your user code in TouchGFXHAL thanks to the hierarchy of the HAL.

/Romain

yes, completely agree. But what happens is, methods generated in this files are used before they are defined. In other words, if I take example of

ManyBlockAllocator<512, /* block size */

          3, /* number of blocks */

          2 /* bytes per pixel */

          > blockAllocator;

blockAllocator is used in void TouchGFXGeneratedHAL::initialize() {} , that is defined before.

So, while compiling the reference/definition of blockAllocator is not find by the compiler, as a result throws error