Esempio n. 1
0
 public virtual void add_core(CortexM core)
 {
     this.cores[core.core_number] = core;
     ///this.cores[core.core_number].setTargetContext(new CachingDebugContext(core, new Debugger.DebugContext(core)));
     this.cores[core.core_number].setTargetContext(new Debugger.DebugContext(core));
     this._root_contexts[core.core_number] = null;
 }
Esempio n. 2
0
        public ArduinoLoader(CortexM cpu, ulong binaryLoadAddress = 0x10000)
        {
            USBEndpoint interruptEndpoint = null;

            this.cpu               = cpu;
            this.machine           = cpu.GetMachine();
            this.binaryLoadAddress = binaryLoadAddress;

            USBCore = new USBDeviceCore(this,
                                        classCode: USBClassCode.CommunicationsCDCControl,
                                        maximalPacketSize: PacketSize.Size16,
                                        vendorId: 0x2341,
                                        productId: 0x805a,
                                        deviceReleaseNumber: 0x0100)
                      .WithConfiguration(configure: c => c
                                         .WithInterface(new Antmicro.Renode.Core.USB.CDC.Interface(this,
                                                                                                   identifier: 0,
                                                                                                   subClassCode: 0x2,
                                                                                                   protocol: 0x1,
                                                                                                   descriptors: new [] {
                new FunctionalDescriptor(CdcFunctionalDescriptorType.Interface, CdcFunctionalDescriptorSubtype.Header, 0x10, 0x01),
                new FunctionalDescriptor(CdcFunctionalDescriptorType.Interface, CdcFunctionalDescriptorSubtype.CallManagement, 0x01, 0x01),
                new FunctionalDescriptor(CdcFunctionalDescriptorType.Interface, CdcFunctionalDescriptorSubtype.AbstractControlManagement, 0x02),
                new FunctionalDescriptor(CdcFunctionalDescriptorType.Interface, CdcFunctionalDescriptorSubtype.Union, 0x00, 0x01)
            })
                                                        .WithEndpoint(Direction.DeviceToHost,
                                                                      EndpointTransferType.Interrupt,
                                                                      maximumPacketSize: 0x08,
                                                                      interval: 0x0a,
                                                                      createdEndpoint: out interruptEndpoint))
                                         .WithInterface(new USBInterface(this,
                                                                         identifier: 1,
                                                                         classCode: USBClassCode.CDCData,
                                                                         subClassCode: 0x0,
                                                                         protocol: 0x0)
                                                        .WithEndpoint(id: 2,
                                                                      direction: Direction.HostToDevice,
                                                                      transferType: EndpointTransferType.Bulk,
                                                                      maximumPacketSize: 0x20,
                                                                      interval: 0x0,
                                                                      createdEndpoint: out hostToDeviceEndpoint)
                                                        .WithEndpoint(id: 3,
                                                                      direction: Direction.DeviceToHost,
                                                                      transferType: EndpointTransferType.Bulk,
                                                                      maximumPacketSize: 0x20,
                                                                      interval: 0x0,
                                                                      createdEndpoint: out deviceToHostEndpoint)));

            // when asked, say that nothing interesting happened
            interruptEndpoint.NonBlocking     = true;
            deviceToHostEndpoint.NonBlocking  = true;
            hostToDeviceEndpoint.DataWritten += HandleData;

            sramBuffer  = new byte[BufferSize];
            flashBuffer = new byte[BufferSize];

            binarySync = new AutoResetEvent(false);
        }
Esempio n. 3
0
        public static void CreateArduinoLoader(this USBIPServer server, CortexM cpu, int?port = null, string name = null)
        {
            var loader = new ArduinoLoader(cpu);

            server.Register(loader, port);

            var emulation = EmulationManager.Instance.CurrentEmulation;

            emulation.ExternalsManager.AddExternal(loader, name ?? "arduinoLoader");
        }
Esempio n. 4
0
        public virtual List <sbyte> _convert_and_check_registers(List <string> reg_list_s)
        {
            // convert to index only
            List <sbyte> reg_list = reg_list_s.Select(reg => CortexM.register_name_to_index(reg)).ToList();

            // Sanity check register values
            foreach (var reg in reg_list)
            {
                if (!CortexM.CORE_REGISTER.Values.Contains(reg))
                {
                    throw new ArgumentOutOfRangeException(String.Format("unknown reg: %d", reg));
                }
                else if ((reg >= 64 || reg == 33) && !this._context.core.has_fpu)
                {
                    throw new ArgumentOutOfRangeException("attempt to read FPU register without FPU");
                }
            }
            return(reg_list);
        }
Esempio n. 5
0
        public override void init(bool bus_accessible = true)
        {
            // Start loading the SVD file
            ///this.loadSVD();
            // Create the DP and turn on debug.
            this.dp.init();
            this.dp.power_up_debug();
            // Create an AHB-AP for the CPU.
            var ap0 = new AHB_AP(this.dp, 0);

            ap0.init(bus_accessible);
            this.add_ap(ap0);
            // Create CortexM core.
            CortexM core0 = new CortexM(this.link, this.dp, this.aps[0], this.memory_map);

            if (bus_accessible)
            {
                core0.init();
            }
            this.add_core(core0);
        }
Esempio n. 6
0
 public void AttachCPU(CortexM cpu)
 {
     this.cpu = cpu;
 }