BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Kaetemi

Pages: [1] 2
1
Discussion - EVE / Re: IDM2040-7A
« on: September 18, 2022, 02:52:03 AM »
You can create C source files with functions and expose them to the GUI editor using the ESD_FUNCTION macro. (You can search the library sources for examples of this.)

RP2040 APIs can be used directly as in any regular RP2040 project. You can hide any code that accesses hardware from the GUI editor by putting it inside #ifndef ESD_SIMULATION guards, so you don't get compile errors in the simulation. (There's no simulation for hardware APIs currently, although as an alternative you could also provide your own implementation or validation stubs of hardware APIs inside a #ifdef ESD_SIMULATION guard, for debugging purposes.)

2
Discussion - EVE / Re: Linux ASTC encoder
« on: July 19, 2022, 07:22:38 PM »
The ASTC blocks for EVE are arranged in a pattern of larger blocks. I'd recommend encoding an image with a number on each square block, and seeing where they end up. That's the easiest way to understand the pattern. :)

3
Below is an example of what does NOT work:

You're missing `BITMAP_HANDLE` before the `VERTEX2F` call. The display list is a state machine, so the draw depends on the state that's set. The handle is used to point to one of 32 bitmap states, which persist across frames. And don't forget `DISPLAY` at the end to end the display list, as it may contain garbage.

Also, you may be missing `BITMAP_SIZE_H` and `BITMAP_LAYOUT_H` calls, their previous state may contain garbage as well.

I recommend using the `EVE_CoDl_` convenience calls from HAL, such as `EVE_CoDl_bitmapLayout`, instead of App_WrCoCmd_Buffer etc, as they simplify compatibility and reduce mistakes. (e.g. `EVE_CoDl_vertex2f_4` includes logic to automatically switch vertex format if your coordinates are out of range, and `EVE_CoDl_vertexFormat` deduplicates redundant state change calls.)

4
Discussion - EVE / Re: Concerns with ESD and generated source
« on: June 25, 2022, 11:15:35 PM »
Code: [Select]
  #if defined(_DEBUG)
   // This will cause a dark red screen in case background video incorrectly swaps the display
   EVE_Hal_startTransfer(phost, EVE_TRANSFER_WRITE, RAM_DL);
   EVE_Hal_transfer32(phost, CLEAR_COLOR_RGB(0x40, 0x00, 0x20));
   EVE_Hal_transfer32(phost, CLEAR(1, 1, 1));

If you ever see this screen, it means a duplicate or spurious display list swap occurred for some reason.
Or in other words, you would have swapped in a completely invalid display list.

See the implementation of EVE_CoCmd_videoFrame, which patches one of those cases.
This is enabled in debug specifically to catch those issues early.

Normally this will always be overwritten by the coprocessor rendering commands, so you should never see this screen.

5
Discussion - EVE / Re: Concerns with ESD and generated source
« on: June 21, 2022, 12:37:32 AM »
Alternatively, instead of using the Esd_Loop function, reimplement this behaviour into your RTOS event loop.

Whenever you get an interrupt from EVE, push an event in your RTOS event loop, check if the current loop state is IDLE and the frame swap is done, and if so call Esd_Update and Esd_Render.

Instead of Esd_WaitSwap, you'll need a new function to check the swap (EVE_Cmd_rp(phost) == EVE_Cmd_wp(phost)) and also check EVE_CMD_FAULT(rp),
refer to EVE_Cmd_waitFlush and Esd_WaitSwap to see how the fault state is resolved correctly - it affects some internal state.
After cmd is swapped or reset, check if EVE_Hal_rd8(phost, REG_DLSWAP) == 0 --- this is just to catch any unexpected behaviour.

In this case Idle will only get called deep in the call stack while the command buffer is full (this should resolve quickly), so from there you can just pump any pending events in your RTOS event loop.

6
Discussion - EVE / Re: EVE screen designer cpu use
« on: June 20, 2022, 10:46:18 PM »
I'm ok with that, I have UI elements that does not use cpu ressource. But I've noticed that widget ESD_MultiGradientRounded use 30% of my CPU. Why?
The emulator has a detection to not redraw the screen if it's presented the same display list twice without changes to graphics ram.

The multi gradient works by writing four colors to a circular bitmap buffer with 64 entries, giving you 32 gradients per frame.
This technique causes a change to graphics ram each frame, which causes the emulator to do a full redraw.

A solution would be to cache the last couple of gradients in the library, and re-use when possible. That'll also let you draw more of these fancy gradients when they share the same colors. :)

7
Discussion - EVE / Re: Concerns with ESD and generated source
« on: June 20, 2022, 10:18:47 PM »
@Kaetemi, thanks for your answer,
Yes, the Idle function callback of the application could be used
for some cases, BUT it is called somewhat  'unpredictable' or multiple times.
  (see Esd_Loop()  =>  Esd_Update() : Idle at least once every frame)
Thanks!

For all the Idle calls that are done during the WaitSwap step, LoopState will be set to ESD_LOOPSTATE_IDLE.
Any other Idle calls that may be done deep in the call stack may have update or render loop state set instead.

As far as the multiple calls, it seems okay to just check in the Idle call if the low power state was already enabled to deduplicate.
Maybe a single IdleEnd call after each batch of Idle calls may be useful to restore back to full speed, though... :)

Do you have any reference device with power management and a reference RTOS to see how this can be integrated in practice?

8
Discussion - EVE / Re: EVE screen designer cpu use
« on: June 14, 2022, 07:46:13 AM »
EmulatorProcess runs the emulator and the user code. Any unusual behavior in your code?
It should normally throttle down by itself already when there are no frame changes being rendered.
The process also runs on the lowest priority by default, so it should only have minimal effect on any other processes regardless. The highest usage will be while recompiling the code.

(If you happen to be running giant ASTC animations, that's the only case on the emulator that's not well optimized, and you might see high usage.)

9
Discussion - EVE / Re: Concerns with ESD and generated source
« on: June 14, 2022, 06:56:26 AM »
* In contradiction to the EVE concept of a co-processor for offloading host MCU from graphics drawing,
   the ESD generated source has an endless, fulltime burner loop for repeated Updates/Render (about each 5-20ms), even if the HMI didn't change!!??
   What is the rational behind this?
   Any chance for changing (in near future) to an event-driven (dirty-state => refresh) model?

It's a simple loop that's familiar to Arduino users. It's also common in games. EVE has a bit of a background in both of those.
It makes things easy to understand for new developers who are already familiar with that style.
For animations it's also convenient.

Having it only run the loop when necessary is feasible, but it'll need more care from developers to flag when a refresh is needed.

     - RTOS unfriendly.
     - this is energy-unfriendly if battery powered.

That said, when the ESD Core library is waiting for something it'll spin on the Idle function callback of the application.
You might be able to take advantage of that call to enter a low power mode when ESD Core is doing nothing, and just go back into full speed based on some interrupt.

It'll spin on Idle in two situations:
  • When in-between frames, and waiting for the display list to swap. This is called from the main loop directly
  • Whenever writing to the coprocessor, and the coprocessor space is full. This is can be called very deep in the call stack
If you want to integrate with an RTOS event loop, then you can just use that event loop, and call the inner loop function once whenever EVE signals a frame swap (and disable the display list swap wait).
Ideally you'll also want to enter into your event loop from that second Idle situation. Mask out any events that would affect the ESD library while it's waiting. Exit the event loop whenever EVE sets some interrupt.

Do you have any reference device with power management and a reference RTOS to see how this can be integrated?

     - what about the touch-input tags repeatedly getting swapped out+in?

Not sure what you mean by this?

* There is a well hidden document BRT_AN_073 for porting ESD source to STM32L4.

That port has not been actively maintained and tested, as far as I know, so not sure what its state is.

10
Discussion - EVE / Re: ESD (4.14.0 / 4.15.0) Bug - WASAPI Buffer Error
« on: April 28, 2022, 06:34:40 AM »
As an immediate temporary workaround, you can disable audio by adding the following line in EVE_HalImpl_BT8XXEMU.c function EVE_HalImpl_open, right before the line phost->EmulatorParameters = params;.
Code: [Select]
params->Flags &= (~BT8XXEMU_EmulatorEnableAudio);

11
Discussion - EVE / Re: Couple of ESD questions / remarks
« on: April 21, 2022, 07:43:48 AM »
3) Same as PushButton, but you'll need to hack Esd_TouchTag to force allocate a specific TAG in s_TagHandlers. (Make a copy of Esd_TouchTag_Start, but with // Allocate tag replaced to just pick the TAG that you need.) The TAG of each key is simply the ASCII code of the character. Then you'll either need an instance of Esd_TouchTag for each key in the CMD_KEYS, or extend it to support a whole range of tags in a single instance instead of just a single Tag. (At // Tag set if (s_TagDown == context->Tag), compare with a range instead, and set context->Tag to s_TagDown whenever the range is matched there.)

12
Discussion - EVE / Re: ESD (4.14.0) - Eclipse Exported (Flash files)
« on: April 07, 2022, 05:53:46 AM »
The export function is erroneously copying the flash binary used by the emulator (which is padded and may have junk) instead of the clean built one. It is a bug.

13
Discussion - EVE / Re: Modifying RAM_DL on the fly
« on: April 07, 2022, 05:49:11 AM »
You can create your display list as your originally planned, then swap it, and create a second duplicate of it. Then you can just edit the vertices as you planned, but then swap between the two copies of your display list each time. :)

14
You can add an additional platform implementation to the HAL library that ESD uses directly, add the appropriate presets to EVE_Config.h, and then modify Toolchain.config to specify the build commands, and Programmer.config to specify a programmer.

For ESD emulation, an ESD_SIMULATION compile flag is always set, which overrides whatever platform flags are set to use the desktop target for the emulator instead. You can also use this flag to hide any C coded hardware behaviour from ESD.

15
Does the currently produced emulator executable accept command line arguments to allow passing the Flash package name and if so please would it be possible to share the syntax required?

The emulator executable is simply your own application, with your main function.

You can handle arguments as any normal C program, and replace the interactive initialization with a programmatic initialization.

Pages: [1] 2