Unable to program and/or erase a S7G2 Device

We are developing on a custom hardware, based on S7G2. The controller part number is R7FS7G27H3A01CFB. All modules required by the application are functional.

There is a requirement to support on-site Firmware Upgrades over Ethernet. To achieve this, I started looking at the TFTP-based firmware upgrade shared here. This is usable with a SK-S7G2.
I created a fresh project with modified pin config file. I also integrated an instance of DHCP client as a separate thread.
I forgot to understand (and modify the contents of bsp_warmstart.c) file.

When I compiled the project, it reported following errors:

miu_bootloader.elf section `.bootloader_record' will not fit in region `ID_CODES'

region `ID_CODES' overflowed by 44 bytes

I looked into the s7g2.ld file, I could see

ID_CODES (rx) : ORIGIN = 0x40120050, LENGTH = 0x10 /* 16 bytes */

I changed it to

ID_CODES (rx) : ORIGIN = 0x40120050, LENGTH = 0x40 /* 64 bytes */

Then, the code compiled just fine. When I programmed my device with it, the debugger ends up at a random address and code does not seem to execute. I tried using the JLink Flasher utility to erase the chip, but no luck there.

Logs for utility:

Connecting to J-Link...
Connecting to target...
ERROR: Could not erase chip.
Selected file: C:/Users/devNull/Desktop/Target_Hardware-Blinky.srec
Conecting to J-Link...
Connecting to target...
ERROR: Could not download file.

I am certain that there is no issue with JTAG/SWD since hours ago I was able to debug and execute application on the same hardware. I have 3 prototypes of this hardware. After the first one failed, I tried other hardware (my mistake!) which was functional.

Now I have 2 boards that needs some fixing. Is there a way I can erase the chip? Also, if anyone can point looking at the project can point where it goes wrong, it would be of great help.



  • In reply to tenballs:

    Thank you tenballs. I appreciate your support. I'll look into it, and will see if it can be validated by experts here before I lock up another microcontroller.