nvm read works now.
This commit is contained in:
parent
28242cc8e1
commit
438c940ed7
@ -35,6 +35,6 @@ typedef enum
|
|||||||
/* ROM code seems to be THUMB */
|
/* ROM code seems to be THUMB */
|
||||||
/* need to be in a THUMB block before calling them */
|
/* need to be in a THUMB block before calling them */
|
||||||
volatile nvmErr_t (*nvm_detect)(nvmInterface_t nvmInterface,nvmType_t* pNvmType) = 0x00006cb9;
|
volatile nvmErr_t (*nvm_detect)(nvmInterface_t nvmInterface,nvmType_t* pNvmType) = 0x00006cb9;
|
||||||
volatile nvmErr_t (*nvm_read)(nvmInterface_t nvmInterface , nvmType_t nvmType , void *pDest, uint32_t address, uint32_t numBytes);
|
volatile nvmErr_t (*nvm_read)(nvmInterface_t nvmInterface , nvmType_t nvmType , void *pDest, uint32_t address, uint32_t numBytes) = 0x00006d69;
|
||||||
|
volatile void(*nvm_setsvar)(uint32_t zero_for_awesome) = 0x00007085;
|
||||||
#endif //NVM_H
|
#endif //NVM_H
|
||||||
|
@ -49,6 +49,7 @@ _start: b _begin
|
|||||||
|
|
||||||
/* these vectors are used for rom patching */
|
/* these vectors are used for rom patching */
|
||||||
.org 0x20
|
.org 0x20
|
||||||
|
.code 16
|
||||||
_RPTV_0_START:
|
_RPTV_0_START:
|
||||||
bx lr /* do nothing */
|
bx lr /* do nothing */
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ _RPTV_3_START:
|
|||||||
ROM_var_start: .word 0
|
ROM_var_start: .word 0
|
||||||
.org 0x7ff
|
.org 0x7ff
|
||||||
ROM_var_end: .word 0
|
ROM_var_end: .word 0
|
||||||
|
.code 32
|
||||||
.align
|
.align
|
||||||
_begin:
|
_begin:
|
||||||
bl _rom_data_init+.-base
|
bl _rom_data_init+.-base
|
||||||
|
@ -29,10 +29,13 @@ void put_hex32(uint32_t x);
|
|||||||
const uint8_t hex[16]={'0','1','2','3','4','5','6','7',
|
const uint8_t hex[16]={'0','1','2','3','4','5','6','7',
|
||||||
'8','9','a','b','c','d','e','f'};
|
'8','9','a','b','c','d','e','f'};
|
||||||
|
|
||||||
|
#define NBYTES 128
|
||||||
__attribute__ ((section ("startup")))
|
__attribute__ ((section ("startup")))
|
||||||
void main(void) {
|
void main(void) {
|
||||||
uint32_t type=0xdeadbeef;
|
nvmType_t type=0;
|
||||||
nvmErr_t err;
|
nvmErr_t err;
|
||||||
|
uint32_t buf[NBYTES/4];
|
||||||
|
uint32_t i;
|
||||||
|
|
||||||
*(volatile uint32_t *)GPIO_PAD_DIR0 = 0x00000100;
|
*(volatile uint32_t *)GPIO_PAD_DIR0 = 0x00000100;
|
||||||
|
|
||||||
@ -69,6 +72,20 @@ void main(void) {
|
|||||||
put_hex32(type);
|
put_hex32(type);
|
||||||
puts("\n\r");
|
puts("\n\r");
|
||||||
|
|
||||||
|
nvm_setsvar(0);
|
||||||
|
|
||||||
|
err = nvm_read(gNvmInternalInterface_c, type, (uint8_t *)buf, 0x1F000, NBYTES);
|
||||||
|
puts("nvm_read returned: 0x");
|
||||||
|
put_hex(err);
|
||||||
|
puts("\n\r");
|
||||||
|
|
||||||
|
for(i=0; i<NBYTES/4; i++) {
|
||||||
|
puts("0x");
|
||||||
|
put_hex32(buf[i]);
|
||||||
|
puts("\n\r");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
while(1) {continue;};
|
while(1) {continue;};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user