-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor spi flash detection #2643
Conversation
You are welcome to add an entry to the CHANGELOG.md as well |
common_arm/flashmem.c
Outdated
} else { | ||
// 0x90 Manufacture ID / device ID | ||
FlashSendByte(ID); | ||
FlashSendByte(0x00); | ||
FlashSendByte(0x00); | ||
FlashSendByte(0x00); | ||
|
||
result->manufacturer_id = (FlashSendByte(0xFF) & 0xFF); | ||
result->device_id = (FlashSendLastByte(0xFF) & 0xFF); | ||
result->mfr_id = (FlashSendByte(0xFF) & 0xFF); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rename made it hard to understand. Please revert.
common_arm/flashmem.c
Outdated
{ 0xEF, 0x12, 0x0000, 8, "W25*40BV" }, // 512k | ||
{ 0xEF, 0x13, 0x0000, 16, "W25*80BV" } // 1024k | ||
}; | ||
const spi_flash_t *spi_flash_p = SpiFlashTable; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you move this table to the header file where you declare it, you can remove the extern reference to it.
Not sure why you complicate it with pointers. I would have a static extern for table_idx, and a "get_item" function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right.
Actually only the number of the 64k pages is needed outside of the flashmem.c file.
rework in progress...
Reverted 'mfr_id' to 'manufacturer_id' Moved devices table definition to flashmem.h Single global variable 'spi_flash_pages64k' The local structure holding the actual device data is used in firmware.c only difference in code: ``` text data bss dec hex filename 223189 138560 6067 367816 59cc8 ./armsrc/obj/fullimage.elf <-- c9e751d darkside: fix backdoor support 223437 138624 6075 368136 59e08 ./armsrc/obj/fullimage.elf <-- this commit ====================================== +248 +64 +8 +320 ```
Awesome! |
spi_flash_data
is a structure of the data, red from the flash IC*spi_flash_p
is a pointer to the detected flash IC, points to the default '256k/4 pages/unknown' device