Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Welcome to the Rockbox Technical Forums!

+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  Beginning steps in kernel disassembly and analysis
« previous next »
  • Print
Pages: 1 2 [3]

Author Topic: Beginning steps in kernel disassembly and analysis  (Read 4175 times)

Offline dconrad

  • Developer
  • Member
  • *
  • Posts: 133
Re: Beginning steps in kernel disassembly and analysis
« Reply #30 on: June 23, 2021, 09:11:01 PM »
Excellent, thanks for holding my hand through this!

Just a couple quick "this should be obvious, but..." questions -

When you say the manual, you're referring to this X1000 Programming Manual?

And it looks like the GPIOs map like this:
PA0-PA31 --> 0x00-0x1F
PB0-PB31 --> 0x20-0x3F
PC0-PC31 --> 0x40-0x5F
PD0-PD31 --> 0x60-0x6F
^^ Is that right?
Logged

Offline dconrad

  • Developer
  • Member
  • *
  • Posts: 133
Re: Beginning steps in kernel disassembly and analysis
« Reply #31 on: June 23, 2021, 10:22:04 PM »
One more data dump for posterity - I think I have some AXP stuff here. I wanted to find this so I could make sure the first attempts wouldn't set them wrong and kill whatever they're hooked up to...

Code: [Select]
                              regulator_init_data_ARRAY_80510ca8[1].*supply_  XREF[1,8]:   80510c38(*), 80510c44(*),
                             regulator_init_data_ARRAY_80510ca8[2].*supply_               80510c50(*), 80510c5c(*),
                             regulator_init_data_ARRAY_80510ca8[3].*supply_               80510c68(*), 80510c74(*),
                             regulator_init_data_ARRAY_80510ca8[4].*supply_               80510c80(*), 80510c8c(*),
                             regulator_init_data_ARRAY_80510ca8[5].*supply_               80510c98(*) 
                             regulator_init_data_ARRAY_80510ca8[6].*supply_
                             regulator_init_data_ARRAY_80510ca8[7].*supply_
                             regulator_init_data_ARRAY_80510ca8[8].*supply_
                             regulator_init_data_ARRAY_80510ca8
        80510ca8 00 00 00        regulato
                 00 5c 75
                 4b 80 d0
           80510ca8 00 00 00 00 5c  regulato                          [0]                               XREF[1]:     80510c38(*) 
                    75 4b 80 d0 12
                    13 00 d0 12 13
              80510ca8 00 00 00 00     char *    00000000                *supply_regu                      XREF[1]:     80510c38(*) 
              80510cac 5c 75 4b 80 d0  regulati                          constraints
                       12 13 00 d0 12
                       13 00 00 00 00
                 80510cac 5c 75 4b 80     char *    s_axp_ldo1_804b755c     *name         = "axp_ldo1"
                 80510cb0 d0 12 13 00     int       1312D0h                 min_uV        v output range - v
                 80510cb4 d0 12 13 00     int       1312D0h                 max_uV        v output range - v
                 80510cb8 00 00 00 00     int       0h                      uV_offset
                 80510cbc 00 00 00 00     int       0h                      min_uA        i output range - i
                 80510cc0 00 00 00 00     int       0h                      max_uA        i output range - i
                 80510cc4 00 00 00 00     uint      0h                      valid_modes_
                 80510cc8 00 00 00 00     uint      0h                      valid_ops_mask
                 80510ccc 00 00 00 00     int       0h                      input_uV      input v, if supply
                 80510cd0 00 00 00 00 00  regulato                          state_disk
                          00 00 00 00 00
                          00 00 00 00 00
                    80510cd0 00 00 00 00     int       0h                      uV            suspend voltage
                    80510cd4 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510cd8 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510cdc 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510ce0 00 00 00 00 00  regulato                          state_mem
                          00 00 00 00 00
                          00 00 00 00 00
                    80510ce0 00 00 00 00     int       0h                      uV            suspend voltage
                    80510ce4 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510ce8 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510cec 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510cf0 00 00 00 00 00  regulato                          state_standby
                          00 00 00 00 00
                          00 00 00 00 00
                    80510cf0 00 00 00 00     int       0h                      uV            suspend voltage
                    80510cf4 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510cf8 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510cfc 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510d00 00 00 00 00     int       0h                      initial_state
                 80510d04 00 00 00 00     uint      0h                      initial_mode
                 80510d08 00 00 00 00     uint      0h                      ramp_delay
                 80510d0c 00              uint:1    0h                      always_on:1
                 80510d0c 00              uint:1    0h                      boot_on:1
                 80510d0c 00 00 00 00     uint:1    0h                      apply_uV      apply uV constrain
              80510d10 01 00 00 00     int       1h                      num_consumer
              80510d14 0c 11 51 80     regulato  DAT_8051110c            *consumer_su
              80510d18 00 00 00 00     int *     00000000                *regulator_i
              80510d1c 00 00 00 00     void *    00000000                *driver_data
           80510d20 00 00 00 00 68  regulato                          [1]                               XREF[1]:     80510c44(*) 
                    75 4b 80 40 77
                    1b 00 a0 5a 32
              80510d20 00 00 00 00     char *    00000000                *supply_regu                      XREF[1]:     80510c44(*) 
              80510d24 68 75 4b 80 40  regulati                          constraints
                       77 1b 00 a0 5a
                       32 00 00 00 00
                 80510d24 68 75 4b 80     char *    s_axp_ldo2_804b7568     *name         = "axp_ldo2"
                 80510d28 40 77 1b 00     int       1B7740h                 min_uV        v output range - v
                 80510d2c a0 5a 32 00     int       325AA0h                 max_uV        v output range - v
                 80510d30 00 00 00 00     int       0h                      uV_offset
                 80510d34 00 00 00 00     int       0h                      min_uA        i output range - i
                 80510d38 00 00 00 00     int       0h                      max_uA        i output range - i
                 80510d3c 00 00 00 00     uint      0h                      valid_modes_
                 80510d40 09 00 00 00     uint      9h                      valid_ops_mask
                 80510d44 00 00 00 00     int       0h                      input_uV      input v, if supply
                 80510d48 00 00 00 00 00  regulato                          state_disk
                          00 00 00 00 00
                          00 00 00 00 00
                    80510d48 00 00 00 00     int       0h                      uV            suspend voltage
                    80510d4c 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510d50 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510d54 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510d58 00 00 00 00 00  regulato                          state_mem
                          00 00 00 00 00
                          00 00 00 00 00
                    80510d58 00 00 00 00     int       0h                      uV            suspend voltage
                    80510d5c 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510d60 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510d64 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510d68 a0 5a 32 00 00  regulato                          state_standby
                          00 00 00 01 00
                          00 00 00 00 00
                    80510d68 a0 5a 32 00     int       325AA0h                 uV            suspend voltage
                    80510d6c 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510d70 01 00 00 00     int       1h                      enabled       reg enabled in sus
                    80510d74 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510d78 02 00 00 00     int       2h                      initial_state
                 80510d7c 00 00 00 00     uint      0h                      initial_mode
                 80510d80 00 00 00 00     uint      0h                      ramp_delay
                 80510d84 00              uint:1    0h                      always_on:1
                 80510d84 00              uint:1    0h                      boot_on:1
                 80510d84 00 00 00 00     uint:1    0h                      apply_uV      apply uV constrain
              80510d88 01 00 00 00     int       1h                      num_consumer
              80510d8c 14 11 51 80     regulato  DAT_80511114            *consumer_su
              80510d90 00 00 00 00     int *     00000000                *regulator_i
              80510d94 00 00 00 00     void *    00000000                *driver_data
           80510d98 00 00 00 00 74  regulato                          [2]                               XREF[1]:     80510c50(*) 
                    75 4b 80 60 ae
                    0a 00 e0 67 35
              80510d98 00 00 00 00     char *    00000000                *supply_regu                      XREF[1]:     80510c50(*) 
              80510d9c 74 75 4b 80 60  regulati                          constraints
                       ae 0a 00 e0 67
                       35 00 00 00 00
                 80510d9c 74 75 4b 80     char *    s_axp_ldo3_804b7574     *name         = "axp_ldo3"
                 80510da0 60 ae 0a 00     int       AAE60h                  min_uV        v output range - v
                 80510da4 e0 67 35 00     int       3567E0h                 max_uV        v output range - v
                 80510da8 00 00 00 00     int       0h                      uV_offset
                 80510dac 00 00 00 00     int       0h                      min_uA        i output range - i
                 80510db0 00 00 00 00     int       0h                      max_uA        i output range - i
                 80510db4 00 00 00 00     uint      0h                      valid_modes_
                 80510db8 09 00 00 00     uint      9h                      valid_ops_mask
                 80510dbc 00 00 00 00     int       0h                      input_uV      input v, if supply
                 80510dc0 00 00 00 00 00  regulato                          state_disk
                          00 00 00 00 00
                          00 00 00 00 00
                    80510dc0 00 00 00 00     int       0h                      uV            suspend voltage
                    80510dc4 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510dc8 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510dcc 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510dd0 00 00 00 00 00  regulato                          state_mem
                          00 00 00 00 00
                          00 00 00 00 00
                    80510dd0 00 00 00 00     int       0h                      uV            suspend voltage
                    80510dd4 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510dd8 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510ddc 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510de0 00 00 00 00 00  regulato                          state_standby
                          00 00 00 00 00
                          00 00 00 00 00
                    80510de0 00 00 00 00     int       0h                      uV            suspend voltage
                    80510de4 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510de8 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510dec 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510df0 00 00 00 00     int       0h                      initial_state
                 80510df4 00 00 00 00     uint      0h                      initial_mode
                 80510df8 00 00 00 00     uint      0h                      ramp_delay
                 80510dfc 00              uint:1    0h                      always_on:1
                 80510dfc 00              uint:1    0h                      boot_on:1
                 80510dfc 00 00 00 00     uint:1    0h                      apply_uV      apply uV constrain
              80510e00 01 00 00 00     int       1h                      num_consumer
              80510e04 1c 11 51 80     regulato  DAT_8051111c            *consumer_su
              80510e08 00 00 00 00     int *     00000000                *regulator_i
              80510e0c 00 00 00 00     void *    00000000                *driver_data
           80510e10 00 00 00 00 80  regulato                          [3]                               XREF[1]:     80510c5c(*) 
                    75 4b 80 40 77
                    1b 00 a0 5a 32
              80510e10 00 00 00 00     char *    00000000                *supply_regu                      XREF[1]:     80510c5c(*) 
              80510e14 80 75 4b 80 40  regulati                          constraints
                       77 1b 00 a0 5a
                       32 00 00 00 00
                 80510e14 80 75 4b 80     char *    s_axp_ldo4_804b7580     *name         = "axp_ldo4"
                 80510e18 40 77 1b 00     int       1B7740h                 min_uV        v output range - v
                 80510e1c a0 5a 32 00     int       325AA0h                 max_uV        v output range - v
                 80510e20 00 00 00 00     int       0h                      uV_offset
                 80510e24 00 00 00 00     int       0h                      min_uA        i output range - i
                 80510e28 00 00 00 00     int       0h                      max_uA        i output range - i
                 80510e2c 00 00 00 00     uint      0h                      valid_modes_
                 80510e30 09 00 00 00     uint      9h                      valid_ops_mask
                 80510e34 00 00 00 00     int       0h                      input_uV      input v, if supply
                 80510e38 00 00 00 00 00  regulato                          state_disk
                          00 00 00 00 00
                          00 00 00 00 00
                    80510e38 00 00 00 00     int       0h                      uV            suspend voltage
                    80510e3c 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510e40 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510e44 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510e48 00 00 00 00 00  regulato                          state_mem
                          00 00 00 00 00
                          00 00 00 00 00
                    80510e48 00 00 00 00     int       0h                      uV            suspend voltage
                    80510e4c 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510e50 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510e54 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510e58 00 00 00 00 00  regulato                          state_standby
                          00 00 00 00 00
                          00 00 00 00 00
                    80510e58 00 00 00 00     int       0h                      uV            suspend voltage
                    80510e5c 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510e60 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510e64 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510e68 00 00 00 00     int       0h                      initial_state
                 80510e6c 00 00 00 00     uint      0h                      initial_mode
                 80510e70 00 00 00 00     uint      0h                      ramp_delay
                 80510e74 00              uint:1    0h                      always_on:1
                 80510e74 00              uint:1    0h                      boot_on:1
                 80510e74 00 00 00 00     uint:1    0h                      apply_uV      apply uV constrain
              80510e78 01 00 00 00     int       1h                      num_consumer
              80510e7c 24 11 51 80     regulato  DAT_80511124            *consumer_su
              80510e80 00 00 00 00     int *     00000000                *regulator_i
              80510e84 00 00 00 00     void *    00000000                *driver_data
           80510e88 00 00 00 00 8c  regulato                          [4]                               XREF[1]:     80510c68(*) 
                    75 4b 80 60 ae
                    0a 00 e0 67 35
              80510e88 00 00 00 00     char *    00000000                *supply_regu                      XREF[1]:     80510c68(*) 
              80510e8c 8c 75 4b 80 60  regulati                          constraints
                       ae 0a 00 e0 67
                       35 00 00 00 00
                 80510e8c 8c 75 4b 80     char *    s_axp_buck1_804b758c    *name         = "axp_buck1"
                 80510e90 60 ae 0a 00     int       AAE60h                  min_uV        v output range - v
                 80510e94 e0 67 35 00     int       3567E0h                 max_uV        v output range - v
                 80510e98 00 00 00 00     int       0h                      uV_offset
                 80510e9c 00 00 00 00     int       0h                      min_uA        i output range - i
                 80510ea0 00 00 00 00     int       0h                      max_uA        i output range - i
                 80510ea4 00 00 00 00     uint      0h                      valid_modes_
                 80510ea8 09 00 00 00     uint      9h                      valid_ops_mask
                 80510eac 00 00 00 00     int       0h                      input_uV      input v, if supply
                 80510eb0 00 00 00 00 00  regulato                          state_disk
                          00 00 00 00 00
                          00 00 00 00 00
                    80510eb0 00 00 00 00     int       0h                      uV            suspend voltage
                    80510eb4 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510eb8 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510ebc 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510ec0 00 00 00 00 00  regulato                          state_mem
                          00 00 00 00 00
                          00 00 00 00 00
                    80510ec0 00 00 00 00     int       0h                      uV            suspend voltage
                    80510ec4 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510ec8 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510ecc 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510ed0 00 00 00 00 00  regulato                          state_standby
                          00 00 00 00 00
                          00 00 00 00 00
                    80510ed0 00 00 00 00     int       0h                      uV            suspend voltage
                    80510ed4 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510ed8 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510edc 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510ee0 00 00 00 00     int       0h                      initial_state
                 80510ee4 00 00 00 00     uint      0h                      initial_mode
                 80510ee8 00 00 00 00     uint      0h                      ramp_delay
                 80510eec 00              uint:1    0h                      always_on:1
                 80510eec 00              uint:1    0h                      boot_on:1
                 80510eec 00 00 00 00     uint:1    0h                      apply_uV      apply uV constrain
              80510ef0 01 00 00 00     int       1h                      num_consumer
              80510ef4 2c 11 51 80     regulato  DAT_8051112c            *consumer_su
              80510ef8 00 00 00 00     int *     00000000                *regulator_i
              80510efc 00 00 00 00     void *    00000000                *driver_data
           80510f00 00 00 00 00 98  regulato                          [5]                               XREF[1]:     80510c74(*) 
                    75 4b 80 60 ae
                    0a 00 b8 b6 22
              80510f00 00 00 00 00     char *    00000000                *supply_regu                      XREF[1]:     80510c74(*) 
              80510f04 98 75 4b 80 60  regulati                          constraints
                       ae 0a 00 b8 b6
                       22 00 00 00 00
                 80510f04 98 75 4b 80     char *    s_axp_buck2_804b7598    *name         = "axp_buck2"
                 80510f08 60 ae 0a 00     int       AAE60h                  min_uV        v output range - v
                 80510f0c b8 b6 22 00     int       22B6B8h                 max_uV        v output range - v
                 80510f10 00 00 00 00     int       0h                      uV_offset
                 80510f14 00 00 00 00     int       0h                      min_uA        i output range - i
                 80510f18 00 00 00 00     int       0h                      max_uA        i output range - i
                 80510f1c 00 00 00 00     uint      0h                      valid_modes_
                 80510f20 09 00 00 00     uint      9h                      valid_ops_mask
                 80510f24 00 00 00 00     int       0h                      input_uV      input v, if supply
                 80510f28 00 00 00 00 00  regulato                          state_disk
                          00 00 00 00 00
                          00 00 00 00 00
                    80510f28 00 00 00 00     int       0h                      uV            suspend voltage
                    80510f2c 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510f30 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510f34 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510f38 00 00 00 00 00  regulato                          state_mem
                          00 00 00 00 00
                          00 00 00 00 00
                    80510f38 00 00 00 00     int       0h                      uV            suspend voltage
                    80510f3c 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510f40 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510f44 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510f48 00 00 00 00 00  regulato                          state_standby
                          00 00 00 00 00
                          00 00 00 00 00
                    80510f48 00 00 00 00     int       0h                      uV            suspend voltage
                    80510f4c 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510f50 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510f54 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510f58 00 00 00 00     int       0h                      initial_state
                 80510f5c 00 00 00 00     uint      0h                      initial_mode
                 80510f60 00 00 00 00     uint      0h                      ramp_delay
                 80510f64 00              uint:1    0h                      always_on:1
                 80510f64 00              uint:1    0h                      boot_on:1
                 80510f64 00 00 00 00     uint:1    0h                      apply_uV      apply uV constrain
              80510f68 01 00 00 00     int       1h                      num_consumer
              80510f6c 34 11 51 80     regulato  DAT_80511134            *consumer_su
              80510f70 00 00 00 00     int *     00000000                *regulator_i
              80510f74 00 00 00 00     void *    00000000                *driver_data
           80510f78 00 00 00 00 a4  regulato                          [6]                               XREF[1]:     80510c80(*) 
                    75 4b 80 60 ae
                    0a 00 e0 67 35
              80510f78 00 00 00 00     char *    00000000                *supply_regu                      XREF[1]:     80510c80(*) 
              80510f7c a4 75 4b 80 60  regulati                          constraints
                       ae 0a 00 e0 67
                       35 00 00 00 00
                 80510f7c a4 75 4b 80     char *    s_axp_buck3_804b75a4    *name         = "axp_buck3"
                 80510f80 60 ae 0a 00     int       AAE60h                  min_uV        v output range - v
                 80510f84 e0 67 35 00     int       3567E0h                 max_uV        v output range - v
                 80510f88 00 00 00 00     int       0h                      uV_offset
                 80510f8c 00 00 00 00     int       0h                      min_uA        i output range - i
                 80510f90 00 00 00 00     int       0h                      max_uA        i output range - i
                 80510f94 00 00 00 00     uint      0h                      valid_modes_
                 80510f98 09 00 00 00     uint      9h                      valid_ops_mask
                 80510f9c 00 00 00 00     int       0h                      input_uV      input v, if supply
                 80510fa0 00 00 00 00 00  regulato                          state_disk
                          00 00 00 00 00
                          00 00 00 00 00
                    80510fa0 00 00 00 00     int       0h                      uV            suspend voltage
                    80510fa4 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510fa8 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510fac 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510fb0 00 00 00 00 00  regulato                          state_mem
                          00 00 00 00 00
                          00 00 00 00 00
                    80510fb0 00 00 00 00     int       0h                      uV            suspend voltage
                    80510fb4 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510fb8 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510fbc 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510fc0 00 00 00 00 00  regulato                          state_standby
                          00 00 00 00 00
                          00 00 00 00 00
                    80510fc0 00 00 00 00     int       0h                      uV            suspend voltage
                    80510fc4 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80510fc8 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80510fcc 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80510fd0 00 00 00 00     int       0h                      initial_state
                 80510fd4 00 00 00 00     uint      0h                      initial_mode
                 80510fd8 00 00 00 00     uint      0h                      ramp_delay
                 80510fdc 00              uint:1    0h                      always_on:1
                 80510fdc 00              uint:1    0h                      boot_on:1
                 80510fdc 00 00 00 00     uint:1    0h                      apply_uV      apply uV constrain
              80510fe0 01 00 00 00     int       1h                      num_consumer
              80510fe4 3c 11 51 80     regulato  DAT_8051113c            *consumer_su
              80510fe8 00 00 00 00     int *     00000000                *regulator_i
              80510fec 00 00 00 00     void *    00000000                *driver_data
           80510ff0 00 00 00 00 b0  regulato                          [7]                               XREF[1]:     80510c8c(*) 
                    75 4b 80 60 ae
                    0a 00 e0 67 35
              80510ff0 00 00 00 00     char *    00000000                *supply_regu                      XREF[1]:     80510c8c(*) 
              80510ff4 b0 75 4b 80 60  regulati                          constraints
                       ae 0a 00 e0 67
                       35 00 00 00 00
                 80510ff4 b0 75 4b 80     char *    s_axp_buck4_804b75b0    *name         = "axp_buck4"
                 80510ff8 60 ae 0a 00     int       AAE60h                  min_uV        v output range - v
                 80510ffc e0 67 35 00     int       3567E0h                 max_uV        v output range - v
                 80511000 00 00 00 00     int       0h                      uV_offset
                 80511004 00 00 00 00     int       0h                      min_uA        i output range - i
                 80511008 00 00 00 00     int       0h                      max_uA        i output range - i
                 8051100c 00 00 00 00     uint      0h                      valid_modes_
                 80511010 09 00 00 00     uint      9h                      valid_ops_mask
                 80511014 00 00 00 00     int       0h                      input_uV      input v, if supply
                 80511018 00 00 00 00 00  regulato                          state_disk
                          00 00 00 00 00
                          00 00 00 00 00
                    80511018 00 00 00 00     int       0h                      uV            suspend voltage
                    8051101c 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80511020 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80511024 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80511028 00 00 00 00 00  regulato                          state_mem
                          00 00 00 00 00
                          00 00 00 00 00
                    80511028 00 00 00 00     int       0h                      uV            suspend voltage
                    8051102c 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80511030 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80511034 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80511038 00 00 00 00 00  regulato                          state_standby
                          00 00 00 00 00
                          00 00 00 00 00
                    80511038 00 00 00 00     int       0h                      uV            suspend voltage
                    8051103c 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80511040 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    80511044 00 00 00 00     int       0h                      disabled      reg disabled in su
                 80511048 00 00 00 00     int       0h                      initial_state
                 8051104c 00 00 00 00     uint      0h                      initial_mode
                 80511050 00 00 00 00     uint      0h                      ramp_delay
                 80511054 00              uint:1    0h                      always_on:1
                 80511054 00              uint:1    0h                      boot_on:1
                 80511054 00 00 00 00     uint:1    0h                      apply_uV      apply uV constrain
              80511058 01 00 00 00     int       1h                      num_consumer
              8051105c 44 11 51 80     regulato  DAT_80511144            *consumer_su
              80511060 00 00 00 00     int *     00000000                *regulator_i
              80511064 00 00 00 00     void *    00000000                *driver_data
           80511068 00 00 00 00 bc  regulato                          [8]                               XREF[1]:     80510c98(*) 
                    75 4b 80 40 77
                    1b 00 a0 5a 32
              80511068 00 00 00 00     char *    00000000                *supply_regu                      XREF[1]:     80510c98(*) 
              8051106c bc 75 4b 80 40  regulati                          constraints
                       77 1b 00 a0 5a
                       32 00 00 00 00
                 8051106c bc 75 4b 80     char *    s_axp_ldoio0_804b75bc   *name         = "axp_ldoio0"
                 80511070 40 77 1b 00     int       1B7740h                 min_uV        v output range - v
                 80511074 a0 5a 32 00     int       325AA0h                 max_uV        v output range - v
                 80511078 00 00 00 00     int       0h                      uV_offset
                 8051107c 00 00 00 00     int       0h                      min_uA        i output range - i
                 80511080 00 00 00 00     int       0h                      max_uA        i output range - i
                 80511084 00 00 00 00     uint      0h                      valid_modes_
                 80511088 09 00 00 00     uint      9h                      valid_ops_mask
                 8051108c 00 00 00 00     int       0h                      input_uV      input v, if supply
                 80511090 00 00 00 00 00  regulato                          state_disk
                          00 00 00 00 00
                          00 00 00 00 00
                    80511090 00 00 00 00     int       0h                      uV            suspend voltage
                    80511094 00 00 00 00     uint      0h                      mode          suspend reg operat
                    80511098 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    8051109c 00 00 00 00     int       0h                      disabled      reg disabled in su
                 805110a0 00 00 00 00 00  regulato                          state_mem
                          00 00 00 00 00
                          00 00 00 00 00
                    805110a0 00 00 00 00     int       0h                      uV            suspend voltage
                    805110a4 00 00 00 00     uint      0h                      mode          suspend reg operat
                    805110a8 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    805110ac 00 00 00 00     int       0h                      disabled      reg disabled in su
                 805110b0 00 00 00 00 00  regulato                          state_standby
                          00 00 00 00 00
                          00 00 00 00 00
                    805110b0 00 00 00 00     int       0h                      uV            suspend voltage
                    805110b4 00 00 00 00     uint      0h                      mode          suspend reg operat
                    805110b8 00 00 00 00     int       0h                      enabled       reg enabled in sus
                    805110bc 00 00 00 00     int       0h                      disabled      reg disabled in su
                 805110c0 00 00 00 00     int       0h                      initial_state
                 805110c4 00 00 00 00     uint      0h                      initial_mode
                 805110c8 00 00 00 00     uint      0h                      ramp_delay
                 805110cc 00              uint:1    0h                      always_on:1
                 805110cc 00              uint:1    0h                      boot_on:1
                 805110cc 00 00 00 00     uint:1    0h                      apply_uV      apply uV constrain
              805110d0 01 00 00 00     int       1h                      num_consumer
              805110d4 4c 11 51 80     regulato  DAT_8051114c            *consumer_su
              805110d8 00 00 00 00     int *     00000000                *regulator_i
              805110dc 00 00 00 00     void *    00000000                *driver_data
                             axp_supply_init_data_805110e0                   XREF[1]:     80510ca4(*) 
        805110e0 54 11 51        axp_supp
                 80 20 03
                 00 00 20
           805110e0 54 11 51 80     power_su  power_supply_info_8051  *battery_info =                   XREF[1]:     80510ca4(*) 
           805110e4 20 03 00 00     uint      320h                    chgcur
           805110e8 20 03 00 00     uint      320h                    chgearcur
           805110ec 20 03 00 00     uint      320h                    chgsuscur
           805110f0 20 03 00 00     uint      320h                    chgclscur
           805110f4 68 10 00 00     uint      1068h                   chgvol
           805110f8 0a 00 00 00     uint      Ah                      chgend
           805110fc 00 00 00 00     int       0h                      limit_on
           80511100 32 00 00 00     uint      32h                     chgpretime
           80511104 e0 01 00 00     uint      1E0h                    chgcsttime
           80511108 19 00 00 00     uint      19h                     adc_freq
                             DAT_8051110c                                    XREF[1]:     80510d14(*) 
        8051110c 00              ??         00h
        8051110d 00              ??         00h
        8051110e 00              ??         00h
        8051110f 00              ??         00h
        80511110 60 75 4b 80     addr       s_ldo1_804b755c+4                                = "ldo1"
                             DAT_80511114                                    XREF[1]:     80510d8c(*) 
        80511114 00              ??         00h
        80511115 00              ??         00h
        80511116 00              ??         00h
        80511117 00              ??         00h
        80511118 6c 75 4b 80     addr       s_ldo2_804b7568+4                                = "ldo2"
                             DAT_8051111c                                    XREF[1]:     80510e04(*) 
        8051111c 00              ??         00h
        8051111d 00              ??         00h
        8051111e 00              ??         00h
        8051111f 00              ??         00h
        80511120 78 75 4b 80     addr       s_ldo3_804b7574+4                                = "ldo3"
                             DAT_80511124                                    XREF[1]:     80510e7c(*) 
        80511124 00              ??         00h
        80511125 00              ??         00h
        80511126 00              ??         00h
        80511127 00              ??         00h
        80511128 84 75 4b 80     addr       s_ldo4_804b7580+4                                = "ldo4"
                             DAT_8051112c                                    XREF[1]:     80510ef4(*) 
        8051112c 00              ??         00h
        8051112d 00              ??         00h
        8051112e 00              ??         00h
        8051112f 00              ??         00h
        80511130 c8 75 4b 80     addr       s_dcdc1_804b75c8                                 = "dcdc1"
                             DAT_80511134                                    XREF[1]:     80510f6c(*) 
        80511134 00              ??         00h
        80511135 00              ??         00h
        80511136 00              ??         00h
        80511137 00              ??         00h
        80511138 d0 75 4b 80     addr       s_vdd_cpu_804b75d0                               = "vdd_cpu"
                             DAT_8051113c                                    XREF[1]:     80510fe4(*) 
        8051113c 00              ??         00h
        8051113d 00              ??         00h
        8051113e 00              ??         00h
        8051113f 00              ??         00h
        80511140 d8 75 4b 80     addr       s_dcdc3_804b75d8                                 = "dcdc3"
                             DAT_80511144                                    XREF[1]:     8051105c(*) 
        80511144 00              ??         00h
        80511145 00              ??         00h
        80511146 00              ??         00h
        80511147 00              ??         00h
        80511148 e0 75 4b 80     addr       s_vdd_core_804b75e0                              = "vdd_core"
                             DAT_8051114c                                    XREF[1]:     805110d4(*) 
        8051114c 00              ??         00h
        8051114d 00              ??         00h
        8051114e 00              ??         00h
        8051114f 00              ??         00h
        80511150 c0 75 4b 80     addr       s_ldoio0_804b75bc+4                              = "ldoio0"
                             power_supply_info_80511154                      XREF[1]:     805110e0(*) 
        80511154 ec 75 4b        power_su
                 80 02 00
                 00 00 68
           80511154 ec 75 4b 80     char *    s_EASTROAD_804b75ec     name          = "EASTROAD"        XREF[1]:     805110e0(*) 
           80511158 02 00 00 00     int       2h                      technology
           8051115c 68 10 00 00     int       1068h                   voltage_max_
           80511160 48 0d 00 00     int       D48h                    voltage_min_
           80511164 00 00 00 00     int       0h                      charge_full_
           80511168 00 00 00 00     int       0h                      charge_empty
           8051116c e4 0c 00 00     int       CE4h                    energy_full_
           80511170 00 00 00 00     int       0h                      energy_empty
           80511174 00 00 00 00     int       0h                      use_for_apm
        80511178 00              ??         00h
        80511179 00              ??         00h
        8051117a 00              ??         00h

Notes from above:
Code: [Select]
dcdc1: 0.70 - 3.50
dcdc2: 0.70 - 2.275 *
dcdc3: 0.70 - 3.50
dcdc4: 0.70 - 3.50 **
ldo1: 1.25 - 1.25
ldo2: 1.80 - 3.30 ***
ldo3: 0.70 - 3.50
ldo4: 1.80 - 3.30
ldo io 0: 1.80 - 3.30

* dcdc2 notes: labelled "vdd_cpu"
**dcdc4 notes: labelled "vdd_core"
*** ldo2 notes: Standby state enabled, 3.30V, initial state "2"
« Last Edit: June 23, 2021, 11:34:41 PM by dconrad »
Logged

Offline amachronic

  • Developer
  • Member
  • *
  • Posts: 269
Re: Beginning steps in kernel disassembly and analysis
« Reply #32 on: June 24, 2021, 06:21:53 AM »
Yeah that's the manual I mean, and you have the GPIO numbering right. I have a "later" version of the manual which I got from Ingenic's FTP last year, marked October 2018. I don't know if there are any meaningful differences.

Re. power supply voltages -- after a reset all voltages will return to a default setting, and they can't be changed until fairly late in the boot. The ranges you got are simply ranges supported by the chip, and somewhere else, there may be an actual voltage setting. That might be in a data table, or could be buried inside a function call; who knows. But if none of the defaults are changed, then there may be nothing to see, unless they decided to redundantly set the defaults somewhere. The OF should be able to report the voltages through sysfs; I don't remember the full paths, but they are named axp_supplyer.N. I think that's how I learned about the Q1's voltage levels, because digging in the kernel wasn't revealing much. The M3K just used default voltages.

X1000 and AXP192 datasheets: https://drive.google.com/drive/folders/19Z_nSW88B7ibtFly0IaWw-yRYT97t9e7
Logged

Offline dconrad

  • Developer
  • Member
  • *
  • Posts: 133
Re: Beginning steps in kernel disassembly and analysis
« Reply #33 on: June 26, 2021, 09:08:22 PM »
So I've got enough code into this gerrit patch that it at least successfully compiles. It is definitely rough. I haven't successfully gotten any sort of life signs out of the player yet though - the backlight doesn't light, and the LCD doesn't show anything when I shine a flashlight into it.

I've been trying to use usbboot with:
Code: [Select]
[root@localhost ingenic_tools]# ./usbboot --cpu x1000 --stage1 ../../build-erosqnative-boot/spl.erosq --wait 5 --stage2 ../../build-erosqnative/rockbox.erosq
Is there anything super-obviously-wrong with what I'm doing - or my patchset?
Logged

Offline amachronic

  • Developer
  • Member
  • *
  • Posts: 269
Re: Beginning steps in kernel disassembly and analysis
« Reply #34 on: June 26, 2021, 09:47:37 PM »
The command line is wrong: use rockbox.bin. The scramble image has 8 bytes of header garbage at the beginning and obviously nothing will work if you get an illegal instruction right at the beginning of execution... assuming it gets that far. Does usbboot report everything is loaded? If you get an error on the 2nd stage it's a problem in the SPL (Use --verbose as the first argument)

I'll check your patch sometime tomorrow. I've been up till 2am trying to debug a weird issue with the shanling and my 256gb card with no luck. So, got to sleep now. Have fun with your problems!
Logged

Offline dconrad

  • Developer
  • Member
  • *
  • Posts: 133
Re: Beginning steps in kernel disassembly and analysis
« Reply #35 on: June 27, 2021, 12:09:40 AM »
Quote
use rockbox.bin.

Aha... That would definitely be a problem, even if it isn't the problem. I'm still not getting any signs of life, but it looks like usbboot is happy enough with it now:

Code: [Select]
[root@localhost ingenic_tools]# ./usbboot --verbose --cpu x1000 --stage1 ../../build-erosqnative-boot/spl.erosq --wait 5 --stage2 ../../build-erosqnative/rockbox.bin
Opening USB device a108:1000
Issue SET_DATA_ADDRESS 0xf4001000
Transfer 10296 bytes from host to device
Issue PROGRAM_START1 0xf4001800
Wait 5 seconds
Issue SET_DATA_ADDRESS 0x80004000
Transfer 746968 bytes from host to device
Issue FLUSH_CACHES
Issue PROGRAM_START2 0x80004000
[root@localhost ingenic_tools]#

I'll keep poking at it tomorrow, definitely don't feel like you have to rush to review my patchset by any means.

Edit: Unless you meant that the spl binary is also subject to this scramble header and needs to be .bin? I thought I had tried that and got an error message, but I'll try again in the morning.
« Last Edit: June 27, 2021, 12:13:55 AM by dconrad »
Logged

Offline dconrad

  • Developer
  • Member
  • *
  • Posts: 133
Re: Beginning steps in kernel disassembly and analysis
« Reply #36 on: June 27, 2021, 09:28:30 AM »
Life!

I can get the screen to flash the backlight by calling spl_error() from just after init in spl-x1000.c:

Code: [Select]
void spl_main(void)
{
    /* Basic hardware init */
    init();

    spl_error();

    /* If doing a USB boot, host PC will upload 2nd stage itself,
     * we should not load anything from flash or change clocks. */
    if((boot_sel & 3) == 2)
        return;

    /* Just pass control to the target... */
    spl_target_boot();
}

It's not much, but it's a starting point. It looks like in the usb boot case, this function returns, but what gets called after that? (aka... where can I put my flashy lights to follow?)

Edit: Looks like spl_error() doesn't flash the backlight if I call it from system_init() in system-x1000.c:

Code: [Select]
void system_init(void)
{
    spl_error();
    // HACK FIXME: this is only for USB booting Rockbox, REMOVE ME
    spl_handle_pre_boot(0);
   
    /* Gate all clocks except CPU/bus/memory/RTC */
    REG_CPM_CLKGR = ~jz_orm(CPM_CLKGR, CPU_BIT, DDR, AHB0, APB0, RTC);

    /* Ungate timers and turn them all off by default */
    jz_writef(CPM_CLKGR, TCU(0), OST(0));
    jz_clrf(OST_ENABLE, OST1, OST2);
    jz_write(OST_1MSK, 1);
    jz_write(OST_1FLG, 0);
    jz_clr(TCU_ENABLE, 0x80ff);
    jz_set(TCU_MASK, 0xff10ff);
    jz_clr(TCU_FLAG, 0xff10ff);
    jz_set(TCU_STOP, 0x180ff);
« Last Edit: June 27, 2021, 09:45:21 AM by dconrad »
Logged

Offline amachronic

  • Developer
  • Member
  • *
  • Posts: 269
Re: Beginning steps in kernel disassembly and analysis
« Reply #37 on: June 27, 2021, 11:21:26 AM »
Quote from: dconrad on June 27, 2021, 12:09:40 AM
Edit: Unless you meant that the spl binary is also subject to this scramble header and needs to be .bin? I thought I had tried that and got an error message, but I'll try again in the morning.
You do need to load spl.erosq with usbboot and not spl.bin. The .erosq file has a different header appended to it, generated by tools/mkspl-x1000.c, not the scramble header. The SPL header gets read by the CPU's boot ROM when booting from flash or SD. In the case of USB boot, I'm not 100% certain whether the header is necessary but it would only be useful for the CPU's "secure boot" mode, which isn't being used -- if it was, presumably you would've had a problem getting code to run at all. In any event, the usbboot tool is written to expect a file with the SPL header, so loading spl.bin using the --stage1 argument won't work.

Quote from: dconrad on June 27, 2021, 09:28:30 AM
It's not much, but it's a starting point. It looks like in the usb boot case, this function returns, but what gets called after that? (aka... where can I put my flashy lights to follow?)
The entry point is ingenic_x1000/crt0.S, from there it calls main() in apps/main.c and the first thing called after that is system_init().

Quote from: dconrad on June 27, 2021, 09:28:30 AM
Edit: Looks like spl_error() doesn't flash the backlight if I call it from system_init() in system-x1000.c:
You will have to take a close look at the memory initialization. It could be wrong for your player, since I only have 64MB X1000E SoCs to test with and not the 32MB X1000. The first thing I would check is to see if you have any memory corruption going on - this happened to me very early on because I didn't set up the DRAM self refresh properly, as a result any memory which wasn't accessed within a short span of time would corrupt because the memory controller wasn't sending the necessary refresh commands. So to check for any corruption, try putting this in the SPL:
Code: [Select]
void spl_main(void)
{
    /* Basic hardware init */
    init();
    memset((void*)0xa0000000, 0, 1024 * 1024);
    return;
}
That's zeroing out the first 1 MiB of memory using an uncached address to bypass the CPU cache. Run it like this and dump out that first 1M of memory:
Code: [Select]
usbboot -v -c x1000 -1 <spl.erosq>
usbboot -v -c x1000 --addr 0xa0000000 --length 1048576 --upload memory0.bin
Wait 1 minute or so, then dump the memory contents again:
Code: [Select]
usbboot -v -c x1000 --addr 0xa0000000 --length 1048576 --upload memory1.bin
hexdump them both and verify that both files are full of zeros as they should be. Repeat this a few times and wait for progressively longer intervals between dumps (arbitrarily, I would try up to 5 minutes just to be on the safe side). Keep the player plugged in, turned on, and don't re-run the SPL, only do the "upload" command. Of course, you should get a file full of zeros every time, but if you see more and more nonzero bytes appearing then DRAM is probably not refreshing correctly.

It could also be another DRAM related problem, eg. incorrect memory mappings or bad initialization. Or maybe even a non-DRAM problem, but I find it unlikely that DRAM would be okay and you can't get past the first few instructions. I just think DRAM corruption is the first and easiest thing to check for, so I'd do that first.

This is the source code for Ingenic's SPL: https://github.com/JaminCheung/x-loader. There's also some in the YuanhuanLiang repo. If it is really a memory related issue, you might start by comparing stuff from there... I wasn't able to find the x-loader source code myself so I simply reverse-engineered the M3K's SPL to write the memory initialization for Rockbox's SPL. Also useful, https://www.jedec.org/ lets you freely download the DDR2 spec, among other things, but you need to create an account first (requires a working email to activate the account; redistribution of their documents isn't allowed).

Here's some useful links for MIPS architecture stuff -- for example, the privileged resource architecture manual tells you how the virtual address space is laid out. Most of this is not directly useful for getting Rockbox running (ie, you probably won't need to actually code anything based on this info), but it's good background material.
  • https://www.mips.com/downloads/introduction-to-the-mips32-architecture-v6-01/
  • https://www.mips.com/downloads/the-mips32-instruction-set-v6-06/
  • https://www.mips.com/downloads/the-mips32-and-micromips32-privileged-resource-architecture-v6-02/
Just keep in mind those manuals have some things in there for multiple revisions of the MIPS architecture. The X1000 is a quasi-MIPS32 Release 2 CPU: it implements the integer r2 instructions according to its manual and from my limited testing, but it doesn't implement any useful stuff from the r2 PRA, and it's even missing some minor stuff from the base Release 1 PRA.

Anyway good luck! Let me know what you find out. At least you've got some progress :)
Logged

Offline dconrad

  • Developer
  • Member
  • *
  • Posts: 133
Re: Beginning steps in kernel disassembly and analysis
« Reply #38 on: June 27, 2021, 12:56:14 PM »
Quote
Quote from: dconrad on June 27, 2021, 09:28:30 AM
Edit: Looks like spl_error() doesn't flash the backlight if I call it from system_init() in system-x1000.c:
You will have to take a close look at the memory initialization. It could be wrong for your player, since I only have 64MB X1000E SoCs to test with and not the 32MB X1000. The first thing I would check is to see if you have any memory corruption going on - this happened to me very early on because I didn't set up the DRAM self refresh properly, as a result any memory which wasn't accessed within a short span of time would corrupt because the memory controller wasn't sending the necessary refresh commands. So to check for any corruption, try putting this in the SPL:
Code: [Select]
void spl_main(void)
{
    /* Basic hardware init */
    init();
    memset((void*)0xa0000000, 0, 1024 * 1024);
    return;
}
That's zeroing out the first 1 MiB of memory using an uncached address to bypass the CPU cache. Run it like this and dump out that first 1M of memory:
Code: [Select]
usbboot -v -c x1000 -1 <spl.erosq>
usbboot -v -c x1000 --addr 0xa0000000 --length 1048576 --upload memory0.bin
Wait 1 minute or so, then dump the memory contents again:
Code: [Select]
usbboot -v -c x1000 --addr 0xa0000000 --length 1048576 --upload memory1.bin
hexdump them both and verify that both files are full of zeros as they should be. Repeat this a few times and wait for progressively longer intervals between dumps (arbitrarily, I would try up to 5 minutes just to be on the safe side). Keep the player plugged in, turned on, and don't re-run the SPL, only do the "upload" command. Of course, you should get a file full of zeros every time, but if you see more and more nonzero bytes appearing then DRAM is probably not refreshing correctly.

It could also be another DRAM related problem, eg. incorrect memory mappings or bad initialization. Or maybe even a non-DRAM problem, but I find it unlikely that DRAM would be okay and you can't get past the first few instructions. I just think DRAM corruption is the first and easiest thing to check for, so I'd do that first.

Well, I took several hex dumps over the course of about 15 minutes, and didn't see any non-zero values at all, so it looks like I'll have to start looking into the DRAM stuff.

Quote
This is the source code for Ingenic's SPL: https://github.com/JaminCheung/x-loader. There's also some in the YuanhuanLiang repo. If it is really a memory related issue, you might start by comparing stuff from there... I wasn't able to find the x-loader source code myself so I simply reverse-engineered the M3K's SPL to write the memory initialization for Rockbox's SPL. Also useful, https://www.jedec.org/ lets you freely download the DDR2 spec, among other things, but you need to create an account first (requires a working email to activate the account; redistribution of their documents isn't allowed).

Here's some useful links for MIPS architecture stuff -- for example, the privileged resource architecture manual tells you how the virtual address space is laid out. Most of this is not directly useful for getting Rockbox running (ie, you probably won't need to actually code anything based on this info), but it's good background material.
  • https://www.mips.com/downloads/introduction-to-the-mips32-architecture-v6-01/
  • https://www.mips.com/downloads/the-mips32-instruction-set-v6-06/
  • https://www.mips.com/downloads/the-mips32-and-micromips32-privileged-resource-architecture-v6-02/
Just keep in mind those manuals have some things in there for multiple revisions of the MIPS architecture. The X1000 is a quasi-MIPS32 Release 2 CPU: it implements the integer r2 instructions according to its manual and from my limited testing, but it doesn't implement any useful stuff from the r2 PRA, and it's even missing some minor stuff from the base Release 1 PRA.

Anyway good luck! Let me know what you find out. At least you've got some progress :)

Thanks for the resources! I'll get started.
Logged

Offline amachronic

  • Developer
  • Member
  • *
  • Posts: 269
Re: Beginning steps in kernel disassembly and analysis
« Reply #39 on: June 27, 2021, 02:28:30 PM »
Hmm, if your DRAM contents are stable the issue might be elsewhere. I suspected DRAM because it's something very early on and not tested on your HW configuration. The only other DRAM-related thing which comes to mind is the addressing bits REG_DDRC_REMAPn, so you might try to confirm that the address mapping works by loop over all memory in the SPL like this:--
Code: [Select]
void spl_main(void)
{
    /* Basic hardware init */
    init();
    uint32_t* ptr = (uint32_t*)0xa0000000;
    unsigned count = 32 * 1024 * 1024 / 4;
    for(unsigned i = 0; i < count; ++i)
        *ptr++ = i;
    return;
}
then grab the memory contents in 1M chunks...
Code: [Select]
usbboot -v -c x1000 --addr 0xa0000000 --length 1048576 --upload mem00.bin
usbboot -v -c x1000 --addr 0xa0100000 --length 1048576 --upload mem01.bin
...
usbboot -v -c x1000 --addr 0xa1f00000 --length 1048576 --upload mem31.bin
cat mem*.bin > memory.bin
then spin up a quick program to go over memory.bin and verify that every word in memory got written with the intended value.

To move the flashing backlight (almost) as early as possible you can call spl_error() at the top of your bootloader's main function. You can also try changing the entry point in the linker script ingenic_x1000/app.lds. That should ensure spl_error() is the absolute first thing that runs.
Code: [Select]
#include "config.h"
#include "cpu.h"

OUTPUT_FORMAT("elf32-littlemips")
OUTPUT_ARCH(MIPS)
ENTRY(_start) /* <- change this to "main" in order to bypass crt0
                     (but be warned, this breaks C ABI because BSS segment won't be zeroed if you do this) */
STARTUP(target/mips/ingenic_x1000/crt0.o)

/* End of the audio buffer, where the codec buffer starts */
#define ENDAUDIOADDR (X1000_DRAM_END - PLUGIN_BUFFER_SIZE - CODEC_SIZE)
Logged

Offline dconrad

  • Developer
  • Member
  • *
  • Posts: 133
Re: Beginning steps in kernel disassembly and analysis
« Reply #40 on: June 27, 2021, 04:02:59 PM »
Quote from: amachronic on June 27, 2021, 02:28:30 PM
Hmm, if your DRAM contents are stable the issue might be elsewhere. I suspected DRAM because it's something very early on and not tested on your HW configuration. The only other DRAM-related thing which comes to mind is the addressing bits REG_DDRC_REMAPn, so you might try to confirm that the address mapping works by loop over all memory in the SPL like this:--
Code: [Select]
void spl_main(void)
{
    /* Basic hardware init */
    init();
    uint32_t* ptr = (uint32_t*)0xa0000000;
    unsigned count = 32 * 1024 * 1024 / 4;
    for(unsigned i = 0; i < count; ++i)
        *ptr++ = i;
    return;
}
then grab the memory contents in 1M chunks...
Code: [Select]
usbboot -v -c x1000 --addr 0xa0000000 --length 1048576 --upload mem00.bin
usbboot -v -c x1000 --addr 0xa0100000 --length 1048576 --upload mem01.bin
...
usbboot -v -c x1000 --addr 0xa1f00000 --length 1048576 --upload mem31.bin
cat mem*.bin > memory.bin
then spin up a quick program to go over memory.bin and verify that every word in memory got written with the intended value.

Oh, you might be on to something here! If I understand the for loop correctly, we're going to write increasing values to every 8th address for 31 1024 blocks. However, I get an interesting pattern where it starts at 00 01 00 00, gets to ff 01 00 00, then does 00 01 00 00 - ff 01 00 00, then moves on to 00 03 00 00 - ff 03 00 00, so on and so forth... I think this might actually be indicative of a problem - is that right?

Code: [Select]
[root@localhost ingenic_tools]# ./usbboot -v -c x1000 -1 ../../build-erosqnative-boot/spl.erosq
Opening USB device a108:1000
Issue SET_DATA_ADDRESS 0xf4001000
Transfer 3596 bytes from host to device
Issue PROGRAM_START1 0xf4001800

[root@localhost ingenic_tools]# ./usbboot -v -c x1000 --addr 0xa0000000 --length 1048576 --upload mem00.bin
Opening USB device a108:1000
Issue SET_DATA_ADDRESS 0xa0000000
Issue SET_DATA_LENGTH 0x100000

[root@localhost ingenic_tools]# hexedit mem00.bin

00000000   00 01 00 00  01 01 00 00  02 01 00 00  03 01 00 00  04 01 00 00  05 01 00 00  06 01 00 00  07 01 00 00  ................................
00000020   08 01 00 00  09 01 00 00  0A 01 00 00  0B 01 00 00  0C 01 00 00  0D 01 00 00  0E 01 00 00  0F 01 00 00  ................................
00000040   10 01 00 00  11 01 00 00  12 01 00 00  13 01 00 00  14 01 00 00  15 01 00 00  16 01 00 00  17 01 00 00  ................................
00000060   18 01 00 00  19 01 00 00  1A 01 00 00  1B 01 00 00  1C 01 00 00  1D 01 00 00  1E 01 00 00  1F 01 00 00  ................................
00000080   20 01 00 00  21 01 00 00  22 01 00 00  23 01 00 00  24 01 00 00  25 01 00 00  26 01 00 00  27 01 00 00   ...!..."...#...$...%...&...'...
000000A0   28 01 00 00  29 01 00 00  2A 01 00 00  2B 01 00 00  2C 01 00 00  2D 01 00 00  2E 01 00 00  2F 01 00 00  (...)...*...+...,...-......./...
000000C0   30 01 00 00  31 01 00 00  32 01 00 00  33 01 00 00  34 01 00 00  35 01 00 00  36 01 00 00  37 01 00 00  0...1...2...3...4...5...6...7...
000000E0   38 01 00 00  39 01 00 00  3A 01 00 00  3B 01 00 00  3C 01 00 00  3D 01 00 00  3E 01 00 00  3F 01 00 00  8...9...:...;...<...=...>...?...
00000100   40 01 00 00  41 01 00 00  42 01 00 00  43 01 00 00  44 01 00 00  45 01 00 00  46 01 00 00  47 01 00 00  @...A...B...C...D...E...F...G...
00000120   48 01 00 00  49 01 00 00  4A 01 00 00  4B 01 00 00  4C 01 00 00  4D 01 00 00  4E 01 00 00  4F 01 00 00  H...I...J...K...L...M...N...O...
00000140   50 01 00 00  51 01 00 00  52 01 00 00  53 01 00 00  54 01 00 00  55 01 00 00  56 01 00 00  57 01 00 00  P...Q...R...S...T...U...V...W...
00000160   58 01 00 00  59 01 00 00  5A 01 00 00  5B 01 00 00  5C 01 00 00  5D 01 00 00  5E 01 00 00  5F 01 00 00  X...Y...Z...[...\...]...^..._...
00000180   60 01 00 00  61 01 00 00  62 01 00 00  63 01 00 00  64 01 00 00  65 01 00 00  66 01 00 00  67 01 00 00  `...a...b...c...d...e...f...g...
000001A0   68 01 00 00  69 01 00 00  6A 01 00 00  6B 01 00 00  6C 01 00 00  6D 01 00 00  6E 01 00 00  6F 01 00 00  h...i...j...k...l...m...n...o...
000001C0   70 01 00 00  71 01 00 00  72 01 00 00  73 01 00 00  74 01 00 00  75 01 00 00  76 01 00 00  77 01 00 00  p...q...r...s...t...u...v...w...
000001E0   78 01 00 00  79 01 00 00  7A 01 00 00  7B 01 00 00  7C 01 00 00  7D 01 00 00  7E 01 00 00  7F 01 00 00  x...y...z...{...|...}...~.......
00000200   80 01 00 00  81 01 00 00  82 01 00 00  83 01 00 00  84 01 00 00  85 01 00 00  86 01 00 00  87 01 00 00  ................................
00000220   88 01 00 00  89 01 00 00  8A 01 00 00  8B 01 00 00  8C 01 00 00  8D 01 00 00  8E 01 00 00  8F 01 00 00  ................................
00000240   90 01 00 00  91 01 00 00  92 01 00 00  93 01 00 00  94 01 00 00  95 01 00 00  96 01 00 00  97 01 00 00  ................................
00000260   98 01 00 00  99 01 00 00  9A 01 00 00  9B 01 00 00  9C 01 00 00  9D 01 00 00  9E 01 00 00  9F 01 00 00  ................................
00000280   A0 01 00 00  A1 01 00 00  A2 01 00 00  A3 01 00 00  A4 01 00 00  A5 01 00 00  A6 01 00 00  A7 01 00 00  ................................
000002A0   A8 01 00 00  A9 01 00 00  AA 01 00 00  AB 01 00 00  AC 01 00 00  AD 01 00 00  AE 01 00 00  AF 01 00 00  ................................
000002C0   B0 01 00 00  B1 01 00 00  B2 01 00 00  B3 01 00 00  B4 01 00 00  B5 01 00 00  B6 01 00 00  B7 01 00 00  ................................
000002E0   B8 01 00 00  B9 01 00 00  BA 01 00 00  BB 01 00 00  BC 01 00 00  BD 01 00 00  BE 01 00 00  BF 01 00 00  ................................
00000300   C0 01 00 00  C1 01 00 00  C2 01 00 00  C3 01 00 00  C4 01 00 00  C5 01 00 00  C6 01 00 00  C7 01 00 00  ................................
00000320   C8 01 00 00  C9 01 00 00  CA 01 00 00  CB 01 00 00  CC 01 00 00  CD 01 00 00  CE 01 00 00  CF 01 00 00  ................................
00000340   D0 01 00 00  D1 01 00 00  D2 01 00 00  D3 01 00 00  D4 01 00 00  D5 01 00 00  D6 01 00 00  D7 01 00 00  ................................
00000360   D8 01 00 00  D9 01 00 00  DA 01 00 00  DB 01 00 00  DC 01 00 00  DD 01 00 00  DE 01 00 00  DF 01 00 00  ................................
00000380   E0 01 00 00  E1 01 00 00  E2 01 00 00  E3 01 00 00  E4 01 00 00  E5 01 00 00  E6 01 00 00  E7 01 00 00  ................................
000003A0   E8 01 00 00  E9 01 00 00  EA 01 00 00  EB 01 00 00  EC 01 00 00  ED 01 00 00  EE 01 00 00  EF 01 00 00  ................................
000003C0   F0 01 00 00  F1 01 00 00  F2 01 00 00  F3 01 00 00  F4 01 00 00  F5 01 00 00  F6 01 00 00  F7 01 00 00  ................................
000003E0   F8 01 00 00  F9 01 00 00  FA 01 00 00  FB 01 00 00  FC 01 00 00  FD 01 00 00  FE 01 00 00  FF 01 00 00  ................................

00000400   00 01 00 00  01 01 00 00  02 01 00 00  03 01 00 00  04 01 00 00  05 01 00 00  06 01 00 00  07 01 00 00  ................................
00000420   08 01 00 00  09 01 00 00  0A 01 00 00  0B 01 00 00  0C 01 00 00  0D 01 00 00  0E 01 00 00  0F 01 00 00  ................................
00000440   10 01 00 00  11 01 00 00  12 01 00 00  13 01 00 00  14 01 00 00  15 01 00 00  16 01 00 00  17 01 00 00  ................................
00000460   18 01 00 00  19 01 00 00  1A 01 00 00  1B 01 00 00  1C 01 00 00  1D 01 00 00  1E 01 00 00  1F 01 00 00  ................................
00000480   20 01 00 00  21 01 00 00  22 01 00 00  23 01 00 00  24 01 00 00  25 01 00 00  26 01 00 00  27 01 00 00   ...!..."...#...$...%...&...'...
000004A0   28 01 00 00  29 01 00 00  2A 01 00 00  2B 01 00 00  2C 01 00 00  2D 01 00 00  2E 01 00 00  2F 01 00 00  (...)...*...+...,...-......./...
000004C0   30 01 00 00  31 01 00 00  32 01 00 00  33 01 00 00  34 01 00 00  35 01 00 00  36 01 00 00  37 01 00 00  0...1...2...3...4...5...6...7...
000004E0   38 01 00 00  39 01 00 00  3A 01 00 00  3B 01 00 00  3C 01 00 00  3D 01 00 00  3E 01 00 00  3F 01 00 00  8...9...:...;...<...=...>...?...
00000500   40 01 00 00  41 01 00 00  42 01 00 00  43 01 00 00  44 01 00 00  45 01 00 00  46 01 00 00  47 01 00 00  @...A...B...C...D...E...F...G...
00000520   48 01 00 00  49 01 00 00  4A 01 00 00  4B 01 00 00  4C 01 00 00  4D 01 00 00  4E 01 00 00  4F 01 00 00  H...I...J...K...L...M...N...O...
00000540   50 01 00 00  51 01 00 00  52 01 00 00  53 01 00 00  54 01 00 00  55 01 00 00  56 01 00 00  57 01 00 00  P...Q...R...S...T...U...V...W...
00000560   58 01 00 00  59 01 00 00  5A 01 00 00  5B 01 00 00  5C 01 00 00  5D 01 00 00  5E 01 00 00  5F 01 00 00  X...Y...Z...[...\...]...^..._...
00000580   60 01 00 00  61 01 00 00  62 01 00 00  63 01 00 00  64 01 00 00  65 01 00 00  66 01 00 00  67 01 00 00  `...a...b...c...d...e...f...g...
000005A0   68 01 00 00  69 01 00 00  6A 01 00 00  6B 01 00 00  6C 01 00 00  6D 01 00 00  6E 01 00 00  6F 01 00 00  h...i...j...k...l...m...n...o...
000005C0   70 01 00 00  71 01 00 00  72 01 00 00  73 01 00 00  74 01 00 00  75 01 00 00  76 01 00 00  77 01 00 00  p...q...r...s...t...u...v...w...
000005E0   78 01 00 00  79 01 00 00  7A 01 00 00  7B 01 00 00  7C 01 00 00  7D 01 00 00  7E 01 00 00  7F 01 00 00  x...y...z...{...|...}...~.......
00000600   80 01 00 00  81 01 00 00  82 01 00 00  83 01 00 00  84 01 00 00  85 01 00 00  86 01 00 00  87 01 00 00  ................................
00000620   88 01 00 00  89 01 00 00  8A 01 00 00  8B 01 00 00  8C 01 00 00  8D 01 00 00  8E 01 00 00  8F 01 00 00  ................................
00000640   90 01 00 00  91 01 00 00  92 01 00 00  93 01 00 00  94 01 00 00  95 01 00 00  96 01 00 00  97 01 00 00  ................................
00000660   98 01 00 00  99 01 00 00  9A 01 00 00  9B 01 00 00  9C 01 00 00  9D 01 00 00  9E 01 00 00  9F 01 00 00  ................................
00000680   A0 01 00 00  A1 01 00 00  A2 01 00 00  A3 01 00 00  A4 01 00 00  A5 01 00 00  A6 01 00 00  A7 01 00 00  ................................
000006A0   A8 01 00 00  A9 01 00 00  AA 01 00 00  AB 01 00 00  AC 01 00 00  AD 01 00 00  AE 01 00 00  AF 01 00 00  ................................
000006C0   B0 01 00 00  B1 01 00 00  B2 01 00 00  B3 01 00 00  B4 01 00 00  B5 01 00 00  B6 01 00 00  B7 01 00 00  ................................
000006E0   B8 01 00 00  B9 01 00 00  BA 01 00 00  BB 01 00 00  BC 01 00 00  BD 01 00 00  BE 01 00 00  BF 01 00 00  ................................
00000700   C0 01 00 00  C1 01 00 00  C2 01 00 00  C3 01 00 00  C4 01 00 00  C5 01 00 00  C6 01 00 00  C7 01 00 00  ................................
00000720   C8 01 00 00  C9 01 00 00  CA 01 00 00  CB 01 00 00  CC 01 00 00  CD 01 00 00  CE 01 00 00  CF 01 00 00  ................................
00000740   D0 01 00 00  D1 01 00 00  D2 01 00 00  D3 01 00 00  D4 01 00 00  D5 01 00 00  D6 01 00 00  D7 01 00 00  ................................
00000760   D8 01 00 00  D9 01 00 00  DA 01 00 00  DB 01 00 00  DC 01 00 00  DD 01 00 00  DE 01 00 00  DF 01 00 00  ................................
00000780   E0 01 00 00  E1 01 00 00  E2 01 00 00  E3 01 00 00  E4 01 00 00  E5 01 00 00  E6 01 00 00  E7 01 00 00  ................................
000007A0   E8 01 00 00  E9 01 00 00  EA 01 00 00  EB 01 00 00  EC 01 00 00  ED 01 00 00  EE 01 00 00  EF 01 00 00  ................................
000007C0   F0 01 00 00  F1 01 00 00  F2 01 00 00  F3 01 00 00  F4 01 00 00  F5 01 00 00  F6 01 00 00  F7 01 00 00  ................................
000007E0   F8 01 00 00  F9 01 00 00  FA 01 00 00  FB 01 00 00  FC 01 00 00  FD 01 00 00  FE 01 00 00  FF 01 00 00  ................................

00000800   00 03 00 00  01 03 00 00  02 03 00 00  03 03 00 00  04 03 00 00  05 03 00 00  06 03 00 00  07 03 00 00  ................................
00000820   08 03 00 00  09 03 00 00  0A 03 00 00  0B 03 00 00  0C 03 00 00  0D 03 00 00  0E 03 00 00  0F 03 00 00  ................................
00000840   10 03 00 00  11 03 00 00  12 03 00 00  13 03 00 00  14 03 00 00  15 03 00 00  16 03 00 00  17 03 00 00  ................................
00000860   18 03 00 00  19 03 00 00  1A 03 00 00  1B 03 00 00  1C 03 00 00  1D 03 00 00  1E 03 00 00  1F 03 00 00  ................................
00000880   20 03 00 00  21 03 00 00  22 03 00 00  23 03 00 00  24 03 00 00  25 03 00 00  26 03 00 00  27 03 00 00   ...!..."...#...$...%...&...'...
000008A0   28 03 00 00  29 03 00 00  2A 03 00 00  2B 03 00 00  2C 03 00 00  2D 03 00 00  2E 03 00 00  2F 03 00 00  (...)...*...+...,...-......./...
000008C0   30 03 00 00  31 03 00 00  32 03 00 00  33 03 00 00  34 03 00 00  35 03 00 00  36 03 00 00  37 03 00 00  0...1...2...3...4...5...6...7...
000008E0   38 03 00 00  39 03 00 00  3A 03 00 00  3B 03 00 00  3C 03 00 00  3D 03 00 00  3E 03 00 00  3F 03 00 00  8...9...:...;...<...=...>...?...
00000900   40 03 00 00  41 03 00 00  42 03 00 00  43 03 00 00  44 03 00 00  45 03 00 00  46 03 00 00  47 03 00 00  @...A...B...C...D...E...F...G...
00000920   48 03 00 00  49 03 00 00  4A 03 00 00  4B 03 00 00  4C 03 00 00  4D 03 00 00  4E 03 00 00  4F 03 00 00  H...I...J...K...L...M...N...O...
00000940   50 03 00 00  51 03 00 00  52 03 00 00  53 03 00 00  54 03 00 00  55 03 00 00  56 03 00 00  57 03 00 00  P...Q...R...S...T...U...V...W...
00000960   58 03 00 00  59 03 00 00  5A 03 00 00  5B 03 00 00  5C 03 00 00  5D 03 00 00  5E 03 00 00  5F 03 00 00  X...Y...Z...[...\...]...^..._...
00000980   60 03 00 00  61 03 00 00  62 03 00 00  63 03 00 00  64 03 00 00  65 03 00 00  66 03 00 00  67 03 00 00  `...a...b...c...d...e...f...g...
000009A0   68 03 00 00  69 03 00 00  6A 03 00 00  6B 03 00 00  6C 03 00 00  6D 03 00 00  6E 03 00 00  6F 03 00 00  h...i...j...k...l...m...n...o...
000009C0   70 03 00 00  71 03 00 00  72 03 00 00  73 03 00 00  74 03 00 00  75 03 00 00  76 03 00 00  77 03 00 00  p...q...r...s...t...u...v...w...
000009E0   78 03 00 00  79 03 00 00  7A 03 00 00  7B 03 00 00  7C 03 00 00  7D 03 00 00  7E 03 00 00  7F 03 00 00  x...y...z...{...|...}...~.......
00000A00   80 03 00 00  81 03 00 00  82 03 00 00  83 03 00 00  84 03 00 00  85 03 00 00  86 03 00 00  87 03 00 00  ................................
00000A20   88 03 00 00  89 03 00 00  8A 03 00 00  8B 03 00 00  8C 03 00 00  8D 03 00 00  8E 03 00 00  8F 03 00 00  ................................
00000A40   90 03 00 00  91 03 00 00  92 03 00 00  93 03 00 00  94 03 00 00  95 03 00 00  96 03 00 00  97 03 00 00  ................................
00000A60   98 03 00 00  99 03 00 00  9A 03 00 00  9B 03 00 00  9C 03 00 00  9D 03 00 00  9E 03 00 00  9F 03 00 00  ................................
00000A80   A0 03 00 00  A1 03 00 00  A2 03 00 00  A3 03 00 00  A4 03 00 00  A5 03 00 00  A6 03 00 00  A7 03 00 00  ................................
00000AA0   A8 03 00 00  A9 03 00 00  AA 03 00 00  AB 03 00 00  AC 03 00 00  AD 03 00 00  AE 03 00 00  AF 03 00 00  ................................
00000AC0   B0 03 00 00  B1 03 00 00  B2 03 00 00  B3 03 00 00  B4 03 00 00  B5 03 00 00  B6 03 00 00  B7 03 00 00  ................................
00000AE0   B8 03 00 00  B9 03 00 00  BA 03 00 00  BB 03 00 00  BC 03 00 00  BD 03 00 00  BE 03 00 00  BF 03 00 00  ................................
00000B00   C0 03 00 00  C1 03 00 00  C2 03 00 00  C3 03 00 00  C4 03 00 00  C5 03 00 00  C6 03 00 00  C7 03 00 00  ................................
00000B20   C8 03 00 00  C9 03 00 00  CA 03 00 00  CB 03 00 00  CC 03 00 00  CD 03 00 00  CE 03 00 00  CF 03 00 00  ................................
00000B40   D0 03 00 00  D1 03 00 00  D2 03 00 00  D3 03 00 00  D4 03 00 00  D5 03 00 00  D6 03 00 00  D7 03 00 00  ................................
00000B60   D8 03 00 00  D9 03 00 00  DA 03 00 00  DB 03 00 00  DC 03 00 00  DD 03 00 00  DE 03 00 00  DF 03 00 00  ................................
00000B80   E0 03 00 00  E1 03 00 00  E2 03 00 00  E3 03 00 00  E4 03 00 00  E5 03 00 00  E6 03 00 00  E7 03 00 00  ................................
00000BA0   E8 03 00 00  E9 03 00 00  EA 03 00 00  EB 03 00 00  EC 03 00 00  ED 03 00 00  EE 03 00 00  EF 03 00 00  ................................
00000BC0   F0 03 00 00  F1 03 00 00  F2 03 00 00  F3 03 00 00  F4 03 00 00  F5 03 00 00  F6 03 00 00  F7 03 00 00  ................................
00000BE0   F8 03 00 00  F9 03 00 00  FA 03 00 00  FB 03 00 00  FC 03 00 00  FD 03 00 00  FE 03 00 00  FF 03 00 00  ................................

00000C00   00 03 00 00  01 03 00 00  02 03 00 00  03 03 00 00  04 03 00 00  05 03 00 00  06 03 00 00  07 03 00 00  ................................
00000C20   08 03 00 00  09 03 00 00  0A 03 00 00  0B 03 00 00  0C 03 00 00  0D 03 00 00  0E 03 00 00  0F 03 00 00  ................................
00000C40   10 03 00 00  11 03 00 00  12 03 00 00  13 03 00 00  14 03 00 00  15 03 00 00  16 03 00 00  17 03 00 00  ................................
00000C60   18 03 00 00  19 03 00 00  1A 03 00 00  1B 03 00 00  1C 03 00 00  1D 03 00 00  1E 03 00 00  1F 03 00 00  ................................
00000C80   20 03 00 00  21 03 00 00  22 03 00 00  23 03 00 00  24 03 00 00  25 03 00 00  26 03 00 00  27 03 00 00   ...!..."...#...$...%...&...'...
00000CA0   28 03 00 00  29 03 00 00  2A 03 00 00  2B 03 00 00  2C 03 00 00  2D 03 00 00  2E 03 00 00  2F 03 00 00  (...)...*...+...,...-......./...
00000CC0   30 03 00 00  31 03 00 00  32 03 00 00  33 03 00 00  34 03 00 00  35 03 00 00  36 03 00 00  37 03 00 00  0...1...2...3...4...5...6...7...
00000CE0   38 03 00 00  39 03 00 00  3A 03 00 00  3B 03 00 00  3C 03 00 00  3D 03 00 00  3E 03 00 00  3F 03 00 00  8...9...:...;...<...=...>...?...
00000D00   40 03 00 00  41 03 00 00  42 03 00 00  43 03 00 00  44 03 00 00  45 03 00 00  46 03 00 00  47 03 00 00  @...A...B...C...D...E...F...G...
00000D20   48 03 00 00  49 03 00 00  4A 03 00 00  4B 03 00 00  4C 03 00 00  4D 03 00 00  4E 03 00 00  4F 03 00 00  H...I...J...K...L...M...N...O...
00000D40   50 03 00 00  51 03 00 00  52 03 00 00  53 03 00 00  54 03 00 00  55 03 00 00  56 03 00 00  57 03 00 00  P...Q...R...S...T...U...V...W...
00000D60   58 03 00 00  59 03 00 00  5A 03 00 00  5B 03 00 00  5C 03 00 00  5D 03 00 00  5E 03 00 00  5F 03 00 00  X...Y...Z...[...\...]...^..._...

So on and so forth... Almost as if it's writing 00 00 00 00 - ff 00 00 00 00, overwriting it with 00 01 00 00 - ff 01 00 00, before moving on to the actual next block for 00 02 00 00 (and overwriting that then, too). - No wait, that's not quite right...

(I did try changing the unsigned types to explicitly uint32_t too, no change.)
« Last Edit: June 27, 2021, 04:09:31 PM by dconrad »
Logged

Offline edi1

  • Member
  • *
  • Posts: 1
Re: Beginning steps in kernel disassembly and analysis
« Reply #41 on: April 21, 2022, 11:50:06 AM »
Quote
0x2c2c2c2c is most definitely the value pointed to by smart_config.write_gram_cmd. 0x2c is the standard write_memory_start command of MIPI DCS, used to initiate writing data to the LCD controller's framebuffer RAM. It's not fb_videomode.flag.

In the M3K kernel sources the init_pixclock member is dropped vs. the YuanhuanLiang repo. That's probably why your fb_videomode struct is too big. Maybe you should check the M3K sources for other structs that seem "wrong", it's possible that the Eros Q is using sources similar to the M3K's. (A reminder that your source won't necessarily line up with the binary!)

So with this in mind, jzfb stuff looks lined up right to me:

Code: [Select]
805147ac = bitfield
             clkply_active_rising=1
             newcfg_fmt_conv=1
             others=0
             (this is standard fare, nothing exotic)
805147b8 = smart_config.bus_width
805147c0 = smart_config.length_data_table
805147c4 = smart_config.data_table

Also a look at this
Code: [Select]
           805147a4 00              uint:1    0h                      pinmd:1
           805147a4 00              uint:1    0h                      pixclk_falli
           805147a4 00              uint:1    0h                      data_enable_
           805147a5 00 00 00 00 00  smart_co                          field_0x1d

That start address 805147a5 is almost certainly wrong. The alignment of the struct is at least 4 bytes and struct alignment = maximum alignment of any member. Plus, the first member must be aligned wrong because enums seem to be ints under the descargar kmspico gratis used (an implementation detail which I haven't bothered to verify but seems to be true).

Weirdly, Ghidra doesn't align structs by default -- in the lower right corner of the struct editor is an unobtrusive "Align" checkbox. Checking that will make Ghidra insert the correct padding to follow C alignment rules (afaict). It seems Ghidra defaults to "packed" alignment by default... it confused me for a couple hours too. :o

In this particular case I think I can say with certainty the alignment is wrong -- but in general, you would need to check the generated code to see if the compiler emitted code to access aligned addresses or unaligned addresses. The lw/sw instructions to load/store a word require 4 byte aligned addresses, whereas to access an improperly aligned word, the compiler would need to generate different instructions -- in the case of MIPS the instructions used would depend on the ISA version targeted, IIRC the older versions don't have any unaligned load/store instructions.

Quote from: dconrad on June 19, 2021, 10:38:06 PM
I have a suspicion that the jzfb_platform_data struct is actually the one outlined in arch/mips/xburst/soc-x1000/include/mach/jzfb.h, could this be true?
That's my assumption. Sure, it's defined in other parts of the xburst tree for other SoCs, but this is an X1000 kernel... where else would it be defined?

Hi

You can reconfigurate kernel with:


zcat /proc/config.gz > .config
« Last Edit: April 21, 2022, 11:52:19 AM by edi1 »
Logged

  • Print
Pages: 1 2 [3]
« previous next »
+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  Beginning steps in kernel disassembly and analysis
 

  • SMF 2.0.19 | SMF © 2021, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.192 seconds with 22 queries.