54 views
in GUI Development by

Hi ~

1. Background

We are using Embedded Wizard in an STM32 environment.
Our product includes both eMMC and SD card as storage devices (FATFS),
so the system needs to support copying files between them depending on the user’s needs.
I’m currently working on building a simple file browser for this purpose.

2. Problem

If a user selects a large file, or a folder that contains many files or subfolders,
the system becomes unresponsive during the copy operation
because EwProcess() is not executed during that time.
As a result, the screen appears frozen from the user's perspective.

3. Question

Since there is no operating system, I can’t use threads.
Is there any special programming technique I can use to solve this problem?

Thanks ~

1 Answer

0 votes
by

Hello,

As you already mentioned, an operating system would typically handle such background operations with threads. On bare-metal systems, you need a different approach.

The solution is to integrate your copy operation into the main loop in a non-blocking way:

The Embedded Wizard main loop already provides a mechanism for this - see Processing Data from your Device Driver(s) in the documentation.

You can use this existing infrastructure:

  • Implement your file copy operation as a non-blocking function that processes small chunks (e.g., 4-16 KB per call)
  • Call this function from within the device driver processing section of the main loop
  • Use a state machine to track progress (IDLE, COPYING, COMPLETED, ERROR)
  • Each call processes one chunk and then returns control to the main loop
  • Between calls, EwProcess() continues to run normally, keeping your GUI responsive

This way, the screen remains fluid and you can display a progress bar to inform the user about the ongoing operation.

Best regards

Manfred

 

Ask Embedded Wizard - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...