Custom MCU project

No, only app_image.

For full erasing
GR5xxx_console.exe erase 0x01000000 0x010XXXXX y 0x01000000 1024 0
In this case config page from 0x1000000 and 0x01002000 also erased.

Can you add this to your platformio.ini

upload_protocol = custom
upload_command = <full path to GR5xxx_console.exe> load $SOURCE sector y

And then use project task Advanced → Verbose Build.

Does uploading work?

No,
Verbose Upload result:

AVAILABLE: blackmagic, custom, jlink
CURRENT: upload_protocol = custom
Uploading .pio\build\genericGR5515IGND\firmware.bin
"load" \xad\xa5 \xef\xa5\xe2\xe1\xef \xa2\xad\xe3\xe2७\xad\xa5\xa9 \xa8\xab\xa8 \xa2\xad\xa5譥\xa9
\xaa\xae\xac\xa0\xad\xa4\xae\xa9, \xa8ᯮ\xab\xad塞\xae\xa9 \xafணࠬ\xac\xae\xa9 \xa8\xab\xa8 \xaf\xa0\xaa\xa5\xe2\xad\xeb\xac 䠩\xab\xae\xac.
*** [upload] Error 1

May be coding error?

Wat is the output of this when you run the command on the console? (Windows + R → cmd.exe, adapt paths to .exe and .bin as needed)

.\GR5xxx_console.exe  load .pio/build/genericGR5515IGND/firmware.bin sector  y
find config 
0%
1%
1%
2%

But I am sure that we should generate bundle image :

\GR5xxx_console.exe generate “.pio/build/genericGR5515IGND/firmware.bin” “.pio/build/genericGR5515IGND/firmware_image.bin” 0x01000000 1024 0

\GR5xxx_console.exe load .pio/build/genericGR5515IGND/firmware_image.bin chip y

I’ve just updated the platform again to include the GProgrammer package + usage. It generates a bundled image now. You should be able to update using again

pio pkg update -g -p "https://github.com/maxgerhardt/platform-goodixgr.git"

But I’m using “program” instead of “load” for upload, does that work too?

Can you update your platform and use the regular “upload” button and see if it successfully loads it?

Hi ,Maximilian

No, the “program” doesnt work . It is successfull, but sigfault occurs during debug .

also for using and “load” and “programm” - it is needed to use errase for flash field from 0x01000000+0x2000+ sizeof bundle. In other case console response with address conflict.

I wait responce from goodix community to well undestanding GP script

I still wait response from goodix community to well understanding GP script.

It seems very weird to me why it would need a full chip erase, the program should erase the parts it wants to program automatically :frowning: Especially when e.g. the erase type of sector or chip is given in the load command.

Good Day.

Last day I have reseached a lot goodix boot command system / dumps and obtained solution.

  1. “program” command allow us write app without generation. Console backend provides operations with image generation and changing of config page ( 0x01000000 - 0x01002000).
    So we should not use “load” command (because this command uploads the bundle bin file directly to the address, similar to j flash link)
    It is sufficient to erase config page becase in other case we have address conflict error with previous app_image

so script :
…/GR5xxx_console.exe erase 0x01000000 0x01002000 y 0x01000000 1024 0
…/GR5xxx_console.exe program .pio/build/genericGR5515IGND/firmware.bin y 0x01000000 1024 0

  1. I have found that

TASKS

Build
Build(genericGR5515IGND)
Verbose Build
Pre-Debug -Build

create different .bin files.
So we cant use .ELF from (build) for debug. Only from Pre-Debug -Build.
When I use upload - PIO generetes wrong file for upload and i have problem with debug

BR
Anton G.

I don’t understand this one – if program also overwrites 0x01000000 with the right data, no previous erase should be needed?

The first 3 should build the functionally same image, they all use the same environment and compiler settings (“release mode”, -Os). But that does not contain debug symbols or debug optimization. Only the debug task will generate a debuggabe elf image, since it’s built with -Og -ggdb3 by default (“debug”).

as i understand - internal bootloader determines occupied sectors by config data from config page.
In case of ansent config , command “program” erase sectors from 0x0100 2000 to +sizeofbin and write .bin to this app_field. Goodix named this SOC.
So it is sifficient to erase only config page
изображение

But how can i run upload task without rebuild? Because predebug .bin is different with pre-upload. So I try debug with one image but uploaded another…

Ah. Set

build_type = debug

in the platformio.ini (docs) to always make all tasks generate a debug image.

This will become obselete once the GProgrammer is properly integrated. PlatformIO can very well build a debug binray, upload the binary via GProgrammer and then connect to it via J-Link – only building a binary once.

debug_load_cmds = preload

will take care of that then. (docs)

I have now dropped the generation of this bundled firmware, used the regular .bin for the program command and added an erase step before uploading. I’ve also auto-set debug_load_cmds = preload for JLink so that it automatically preloads the debug binary via the regular upload protocol (aka gprogrammer).

If this works, the upload button should now actually work and the regular “PIO Debug” debugging task should work. All with without any build_type or debug_load_cmds modfications. Please update and retest.

(Or post logs of project task → Advanced → Verbose Upload if uploading fails, or debugging fails, etc.)

Yes, this works. Debug and upload.
Great work.

1 Like