Thread: Discussion Walkera DEVO Tx Hacking
View Single Post
Old Apr 06, 2012, 11:55 AM
PhracturedBlue is offline
Find More Posts by PhracturedBlue
Registered User
Joined Jan 2012
682 Posts
Here is an updated version of my code. It should use the model number as the index to the proper 896byte, and read the ROM into the buffer (which should end up in the model memory). It doesn't make sense to use this until we can manage to capture even a single page, but it should be a good starting point once we figure out what is wrong. I switched from 2kB pagesize to 896byte page-size due to the CRC being written at 0x38F. I figured out that if I try to write to any offset of R0, the write doesn't happen (i.e. for some reason I can only update R0[0], and not R0[1] or R0[2]). I can't actually test this code, but it does compile cleanly
Code:
ResetModelData:
   MOVW   R2, #896          /*We can only capture 896 bytes before the CRC???*/
   LDRB   R1, [R0, #10]     /*Retrieve the model number (in ascii) from memory pointed to by R0*/
   SUB    R1, R1, #49       /*convert model number to value (0 based) */
   MUL    R1, R1, R2        /*Choose which page to read (we'll read from 0x00000000, not 0x08000000)*/
   ADD    R2, R2, R1        /*Set R2 to R1 + page-size*/
Loop:
   LDR    R3, [R1]          /*Retrieve 4bytes from ROM */
   STR    R3, [R0]          /*Store 4 bytes in buffer */
   ADD    R1, R1, #4        /*Increment pointers */
   ADD    R0, R0, #4
   CMP    R1, R2            /*Check if we are done */
   BNE    Loop
   MOV    PC, LR
PhracturedBlue is offline Find More Posts by PhracturedBlue
Reply With Quote