AssertionError: Flash pages (1024 bytes) do not fit evenly into sector (128 bytes)
Open
Nobody has claimed this yet.
cmsis-pack
target
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 560
- Avg merge
- 1h 41m
- Merged PRs (30d)
- 3
Description
I'm using the B-L072Z-LRWAN evaluation board from ST, and I'm trying to flash a program into the MCU memory using the gdb "load" command, but I receive the following error:
0000392:INFO:board:Target type is stm32l072cz
0000467:INFO:dap:DP IDR = 0x0bc11477 (v1 MINDP rev0)
0000496:INFO:ap:AP#0 IDR = 0x04770031 (AHB-AP var3 rev0)
0000514:INFO:rom_table:AP#0 ROM table #0 @ 0xf0000000 (designer=020 part=447)
0000528:INFO:rom_table:[0]<e00ff000:ROM class=1 designer=43b part=4c0>
0000528:INFO:rom_table: AP#0 ROM table #1 @ 0xe00ff000 (designer=43b part=4c0)
0000542:INFO:rom_table: [0]<e000e000:SCS-M0+ class=14 designer=43b part=008>
0000551:INFO:rom_table: [1]<e0001000:DWT-M0+ class=14 designer=43b part=00a>
0000560:INFO:rom_table: [2]<e0002000:BPU class=14 designer=43b part=00b>
0000565:INFO:cortex_m:CPU core #0 is Cortex-M0+ r0p1
0000574:INFO:dwt:2 hardware watchpoints
0000584:INFO:fpb:4 hardware breakpoints, 0 literal comparators
0000604:INFO:server:Semihost server started on port 4444
0000605:INFO:gdbserver:GDB server started on port 3333
0001201:INFO:gdbserver:One client connected!
0008731:ERROR:gdbserver:Unhandled exception in handle_message: Flash pages (1024 bytes) do not fit evenly into sector (128 bytes)
Traceback (most recent call last):
File ".local/lib/python3.5/site-packages/pyocd/gdbserver/gdbserver.py", line 539, in handle_message
reply = handler(msg[msgStart:])
File ".local/lib/python3.5/site-packages/pyocd/gdbserver/gdbserver.py", line 760, in v_command
return self.flash_op(data)
File ".local/lib/python3.5/site-packages/pyocd/gdbserver/gdbserver.py", line 876, in flash_op
self.flash_loader.commit()
File ".local/lib/python3.5/site-packages/pyocd/flash/loader.py", line 505, in commit
keep_unwritten=self._keep_unwritten)
File ".local/lib/python3.5/site-packages/pyocd/flash/flash_builder.py", line 384, in program
self._build_sectors_and_pages(keep_unwritten)
File ".local/lib/python3.5/site-packages/pyocd/flash/flash_builder.py", line 245, in _build_sectors_and_pages
current_sector.add_page(current_page)
File ".local/lib/python3.5/site-packages/pyocd/flash/flash_builder.py", line 78, in add_page
"into sector (%d bytes)" % (page.size, self.size)
AssertionError: Flash pages (1024 bytes) do not fit evenly into sector (128 bytes)
I downloaded the CMSIS pack for the stm32l072cz target. I'm using pyOCD version 0.20.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with pyocd/flash/flash_builder.py, especially _build_sectors_and_pages and add_page, then follow the call from pyocd/flash/loader.py and the GDB server. Reproduce the gdb load on the STM32L072CZ using pyOCD 0.20.1; done means the reported page/sector assertion no longer occurs during flashing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100