|
| 1 | + |
| 2 | +/********************************************************************* |
| 3 | +* |
| 4 | +* OnProjectLoad |
| 5 | +* |
| 6 | +* Function description |
| 7 | +* Project load routine. Required. |
| 8 | +* |
| 9 | +********************************************************************** |
| 10 | +*/ |
| 11 | +void OnProjectLoad (void) { |
| 12 | + Project.SetTraceSource ("Trace Pins"); |
| 13 | + Project.SetDevice ("R7FA8M1AH"); |
| 14 | + Project.SetHostIF ("USB", ""); |
| 15 | + Project.SetTargetIF ("SWD"); |
| 16 | + Project.SetTIFSpeed ("50 MHz"); |
| 17 | + |
| 18 | + Project.AddSvdFile ("$(InstallDir)/Config/CPU/Cortex-M85F.svd"); |
| 19 | + Project.AddSvdFile ("../../../../../../../cmsis-svd-data/data/Renesas/R7FA6M5BH.svd"); |
| 20 | + |
| 21 | + File.Open ("../../../../../../examples/cmake-build-ra8m1_ek/device/cdc_msc/cdc_msc.elf"); |
| 22 | +} |
| 23 | +/********************************************************************* |
| 24 | +* |
| 25 | +* BeforeTargetConnect |
| 26 | +* |
| 27 | +* Function description |
| 28 | +* Event handler routine. Optional. |
| 29 | +* |
| 30 | +********************************************************************** |
| 31 | +*/ |
| 32 | +void BeforeTargetConnect (void) { |
| 33 | + // Trace pin init is done by J-Link script file as J-Link script files are IDE independent |
| 34 | + //Project.SetJLinkScript("../../../debug.jlinkscript"); |
| 35 | + Project.SetJLinkScript ("$(ProjectDir)/Renesas_RA8_TracePins.pex"); |
| 36 | +} |
| 37 | + |
| 38 | +/********************************************************************* |
| 39 | +* |
| 40 | +* AfterTargetConnect |
| 41 | +* |
| 42 | +* Function description |
| 43 | +* Event handler routine. Optional. |
| 44 | +* |
| 45 | +********************************************************************** |
| 46 | +*/ |
| 47 | +//void AfterTargetConnect (void) { |
| 48 | +//} |
| 49 | + |
| 50 | +/********************************************************************* |
| 51 | +* |
| 52 | +* TargetDownload |
| 53 | +* |
| 54 | +* Function description |
| 55 | +* Replaces the default program download routine. Optional. |
| 56 | +* |
| 57 | +********************************************************************** |
| 58 | +*/ |
| 59 | +//void TargetDownload (void) { |
| 60 | +//} |
| 61 | + |
| 62 | +/********************************************************************* |
| 63 | +* |
| 64 | +* BeforeTargetDownload |
| 65 | +* |
| 66 | +* Function description |
| 67 | +* Event handler routine. Optional. |
| 68 | +* |
| 69 | +********************************************************************** |
| 70 | +*/ |
| 71 | +//void BeforeTargetDownload (void) { |
| 72 | +//} |
| 73 | + |
| 74 | +/********************************************************************* |
| 75 | +* |
| 76 | +* AfterTargetDownload |
| 77 | +* |
| 78 | +* Function description |
| 79 | +* Event handler routine. Optional. |
| 80 | +* The default implementation initializes SP and PC to reset values. |
| 81 | +* |
| 82 | +********************************************************************** |
| 83 | +*/ |
| 84 | +void AfterTargetDownload (void) { |
| 85 | + _SetupTarget(); |
| 86 | +} |
| 87 | + |
| 88 | +/********************************************************************* |
| 89 | +* |
| 90 | +* BeforeTargetDisconnect |
| 91 | +* |
| 92 | +* Function description |
| 93 | +* Event handler routine. Optional. |
| 94 | +* |
| 95 | +********************************************************************** |
| 96 | +*/ |
| 97 | +//void BeforeTargetDisconnect (void) { |
| 98 | +//} |
| 99 | + |
| 100 | +/********************************************************************* |
| 101 | +* |
| 102 | +* AfterTargetDisconnect |
| 103 | +* |
| 104 | +* Function description |
| 105 | +* Event handler routine. Optional. |
| 106 | +* |
| 107 | +********************************************************************** |
| 108 | +*/ |
| 109 | +//void AfterTargetDisconnect (void) { |
| 110 | +//} |
| 111 | + |
| 112 | +/********************************************************************* |
| 113 | +* |
| 114 | +* AfterTargetHalt |
| 115 | +* |
| 116 | +* Function description |
| 117 | +* Event handler routine. Optional. |
| 118 | +* |
| 119 | +********************************************************************** |
| 120 | +*/ |
| 121 | +//void AfterTargetHalt (void) { |
| 122 | +//} |
| 123 | + |
| 124 | +/********************************************************************* |
| 125 | +* |
| 126 | +* BeforeTargetResume |
| 127 | +* |
| 128 | +* Function description |
| 129 | +* Event handler routine. Optional. |
| 130 | +* |
| 131 | +********************************************************************** |
| 132 | +*/ |
| 133 | +//void BeforeTargetResume (void) { |
| 134 | +//} |
| 135 | + |
| 136 | +/********************************************************************* |
| 137 | +* |
| 138 | +* OnSnapshotLoad |
| 139 | +* |
| 140 | +* Function description |
| 141 | +* Called upon loading a snapshot. Optional. |
| 142 | +* |
| 143 | +* Additional information |
| 144 | +* This function is used to restore the target state in cases |
| 145 | +* where values cannot simply be written to the target. |
| 146 | +* Typical use: GPIO clock needs to be enabled, before |
| 147 | +* GPIO is configured. |
| 148 | +* |
| 149 | +********************************************************************** |
| 150 | +*/ |
| 151 | +//void OnSnapshotLoad (void) { |
| 152 | +//} |
| 153 | + |
| 154 | +/********************************************************************* |
| 155 | +* |
| 156 | +* OnSnapshotSave |
| 157 | +* |
| 158 | +* Function description |
| 159 | +* Called upon saving a snapshot. Optional. |
| 160 | +* |
| 161 | +* Additional information |
| 162 | +* This function is usually used to save values of the target |
| 163 | +* state which can either not be trivially read, |
| 164 | +* or need to be restored in a specific way or order. |
| 165 | +* Typically use: Memory Mapped Registers, |
| 166 | +* such as PLL and GPIO configuration. |
| 167 | +* |
| 168 | +********************************************************************** |
| 169 | +*/ |
| 170 | +//void OnSnapshotSave (void) { |
| 171 | +//} |
| 172 | + |
| 173 | +/********************************************************************* |
| 174 | +* |
| 175 | +* OnError |
| 176 | +* |
| 177 | +* Function description |
| 178 | +* Called when an error occurred. Optional. |
| 179 | +* |
| 180 | +********************************************************************** |
| 181 | +*/ |
| 182 | +//void OnError (void) { |
| 183 | +//} |
| 184 | + |
| 185 | +/********************************************************************* |
| 186 | +* |
| 187 | +* AfterProjectLoad |
| 188 | +* |
| 189 | +* Function description |
| 190 | +* After Project load routine. Optional. |
| 191 | +* |
| 192 | +********************************************************************** |
| 193 | +*/ |
| 194 | +//void AfterProjectLoad (void) { |
| 195 | +//} |
| 196 | + |
| 197 | +/********************************************************************* |
| 198 | +* |
| 199 | +* _SetupTarget |
| 200 | +* |
| 201 | +* Function description |
| 202 | +* Setup the target. |
| 203 | +* Called by AfterTargetReset() and AfterTargetDownload(). |
| 204 | +* |
| 205 | +* Auto-generated function. May be overridden by Ozone. |
| 206 | +* |
| 207 | +********************************************************************** |
| 208 | +*/ |
| 209 | +void _SetupTarget(void) { |
| 210 | + unsigned int SP; |
| 211 | + unsigned int PC; |
| 212 | + unsigned int VectorTableAddr; |
| 213 | + |
| 214 | + VectorTableAddr = Elf.GetBaseAddr(); |
| 215 | + // |
| 216 | + // Set up initial stack pointer |
| 217 | + // |
| 218 | + SP = Target.ReadU32(VectorTableAddr); |
| 219 | + if (SP != 0xFFFFFFFF) { |
| 220 | + Target.SetReg("SP", SP); |
| 221 | + } |
| 222 | + // |
| 223 | + // Set up entry point PC |
| 224 | + // |
| 225 | + PC = Elf.GetEntryPointPC(); |
| 226 | + if (PC != 0xFFFFFFFF) { |
| 227 | + Target.SetReg("PC", PC); |
| 228 | + } else { |
| 229 | + Util.Error("Project script error: failed to set up entry point PC", 1); |
| 230 | + } |
| 231 | +} |
0 commit comments