I don't see how the reference manual is unclear, so my answer is basically just a quote:
The user area in Flash memory can be protected against unwanted write
operations. Two write-protected (WRP) areas can be defined, with page
(2 KByte) granularity. The area is defined by a start page offset and
an end page offset related to the physical Flash memory base address.
These offsets are defined in the WRP address registers: Flash WRP area
A address register (FLASH_WRP1AR), Flash WRP area B address register
The WRP “y” area (y=A,B) is defined from the address:
Flash memory Base address + [WRP1y_STRT x 0x800] (included) to the
address: Flash memory Base address + [(WRP1y_END+1) x 0x800]
For example, to protect by WRP from the address 0x0806
2800 (included) to the address 0x0807 07FF (included):
• if boot in
flash is selected, FLASH_WRP1AR register must be programmed with:
– WRP1A_STRT = 0xC5.
– WRP1A_END = 0xE0.
WRP1B_STRT and WRP1B_END in FLASH_WRP1BR can be used instead (area “B” in Flash memory).
So the end page is included. For your example:
Start address = 0x800 0000 + 0 * 0x800 = 0x800 0000
End address = 0x800 0000 + (4+1) * 0x800 = 0x800 2800
So the flash from 0x800 0000 to 0x800 27FF will be protected.
Maybe what is confusing is the word "excluded" what is excluded is the end address as that would be the byte at the start of the next page. So their formula should probably read something like:
Flash is protected from: Flash memory Base address + [WRP1y_STRT x 0x800] to the address: Flash memory Base address + [(WRP1y_END+1) x 0x800 - 1]
Would that be clearer? I don't know.