bootloader | USB Bootloader for Spark Firmware | Change Data Capture library

 by   particle-iot-archived C Version: Current License: Non-SPDX

kandi X-RAY | bootloader Summary

kandi X-RAY | bootloader Summary

bootloader is a C library typically used in Utilities, Change Data Capture applications. bootloader has no bugs, it has no vulnerabilities and it has low support. However bootloader has a Non-SPDX License. You can download it from GitHub.

USB Bootloader for Spark Firmware
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              bootloader has a low active ecosystem.
              It has 36 star(s) with 13 fork(s). There are 71 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 3 open issues and 2 have been closed. On average issues are closed in 4 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of bootloader is current.

            kandi-Quality Quality

              bootloader has no bugs reported.

            kandi-Security Security

              bootloader has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              bootloader has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              bootloader releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of bootloader
            Get all kandi verified functions for this library.

            bootloader Key Features

            No Key Features are available at this moment for bootloader.

            bootloader Examples and Code Snippets

            No Code Snippets are available at this moment for bootloader.

            Community Discussions

            QUESTION

            Python File Error: unpack requires a buffer of 16 bytes
            Asked 2021-Jun-04 at 18:43

            im trying to use pyinstaller to convert this python file to a exe file, but whenever i try to do this i get an error in the output. Im using cmd with the auto-py-to-exe command and ive been trying to figure out what this error means but i cannot understand a thing about what is going on.

            If anyone knows how to fix this, please help. Everything shown is the information I know.

            Here is my code:

            ...

            ANSWER

            Answered 2021-Jun-04 at 18:43

            The icon for your program needs to be a valid .ico file; it can't be just a renamed .png for instance. Source: this post I found when googling the error.

            Source https://stackoverflow.com/questions/67842319

            QUESTION

            Problem while making assembly bootloader, that writes all the background colors to the video memory
            Asked 2021-May-23 at 12:47

            I would like to make a simple bootloader, that writes all the background colors to next lines on the screen.
            The problem is, that it only changes the color of the first line to black and the second line to blue, while it should display all 16 colors. I think, that there is something wrong with loop1:, but I don't know what.
            Useful informations:

            • I am writing directly to the text video memory, starting from address 0xb8000, using method described in this forum post.
            • I am using flat assembler 1.73.27 for Windows (fasm assembler).
            • I am testing my program on real computer (booting from usb), not an emulator.
            • I am not including any photos, because of this post.

            My code (fasm assembly):

            ...

            ANSWER

            Answered 2021-May-12 at 14:29

            You are leaving loop1 when ah is not less than 0xff anymore.
            The term less/greater is used in x86 assembly when signed numbers are compared. Number 0xff treated as signed 8bit integer has the value -1 and ah as signed byte (-128..+127), starts at 0x0f + 0x10 = 0x1f. And 31 < -1 is false on the first iteration, so loop1 is abandoned after the first call procedure1.

            When comparing unsigned numbers we use term below/above. Instead of jl loop1 use jb loop1. Similary in procedure1: replace jl procedure1 with jb procedure1. (https://www.felixcloutier.com/x86/jcc)

            Source https://stackoverflow.com/questions/67493946

            QUESTION

            SparkFun RP2040 and MicroPython
            Asked 2021-May-22 at 03:44

            I am a software engineer working on a microcontroller system for a side project. The microcontroller I am using is the SparkFun ProMicro (based on the RP2040 board). I am trying to flash the board so that I can write data to the onboard flash memory.

            All of the tutorials I have found online suggest starting in boot mode, dragging and dropping the UF2 file, and done!

            When I do this, the microcontroller ejects from my computer. Is that meant to happen? It just reboots then doesn't reboot in bootloader?

            Once I got MicroPython installed I moved on to writing and flashing code to the board.

            I am using the Thonny IDE which identified the correct board (albeit the PICO), then saved the following file as main.py (taken from RPI foundation). It prints toggle, and I believe the output shows that it is being printed from the board, but the light on the board isn't blinking. (code and output below)

            I considered that the pinout could be different from this board and the PICO, but some research shows they both use Pin 25 for the LED control.

            All this leads me to believe I am on the right path, but I think I am missing something that is taken for granted in the tutorials. My end goal is to write arbitrary text data to flash storage, but I understand it can only take about 8000-10,000 writes before it becomes unreliable, so I want to test that I can write working code before I use some of those.

            Is there something I am missing, or am I not thinking about this in the right way?

            ...

            ANSWER

            Answered 2021-May-18 at 03:31

            When I do this, the microcontroller ejects from my computer. Is that meant to happen? It just reboots then doesn't reboot in bootloader?

            Yep.

            but the light on the board isn't blinking.

            Maybe your LED is busted, cause your code is right.

            My end goal is to write arbitrary text data to flash storage

            That's a terrible idea, unless you just like burning up boards for no good reason. Get an SD Card reader or concoct one out of a solution like this one, and use this sdcard library that will even mount your card, and add it to the syspath. Then you can essentially write all the arbitrary text data you like without burning up your RP2040.

            Source https://stackoverflow.com/questions/67574800

            QUESTION

            BIOS Interrupt 13 read sector not working
            Asked 2021-May-20 at 06:06

            I have gotten into assembly operating system development and I am setting up a two-stage bootloader at the moment. I have set up the first stage, but when I reset the disk and read the second sector, i get a bunch of giberish on screen. When I try to call the code that should have been loaded at 0x1000, nothing happens (as far as I am aware). I have tried to find solutions, but none of them that I have found seem to work, and I am running out of luck. Here is my full code:

            ...

            ANSWER

            Answered 2021-May-20 at 06:06

            Some problems:

            a) The BIOS "read disk sector/s" function requires a segment (in ES) and an offset (in BX). You aren't providing an offset (not setting BX to anything) so there's no sane way to guess where the BIOS might load the sector (it could be anywhere within the 64 KiB segment requested by ES).

            b) Regardless of how sector is created, it can't be a segment (for the mov ax, sector, mov es, ax) and also be an "offset in the current code segment" (for jmp sector), so one of them must be wrong. For "sector = 0x1000" it looks like it was supposed to be an "offset in current code segment" (and that the code to read the sector should set ES to 0x07C0 to match the assumed current code segment and do mov bx,sector to treat sector as an offset in the requested segment).

            c) I'd strongly recommend setting segments to zero wherever possible. This helps to avoid confusion and mistakes (especially for beginners) and makes it much easier to switch to/from protected mode (or long mode) later. To do this you would need to use org 0x7C00 (rather than "implied org 0 because it wasn't explicitly set") in addition to changing segment register loads (e.g. mov ax, 07C0h, mov es,ax would become mov ax, 0, mov es,ax). This would include the stack (where I'd recommend using "SS:SP = 0:0x7C00"). Don't forget that the stack segment limit often doesn't actually limit anything - e.g. a push or call when the stack is "full" just causes SP to overflow and wrap around from 0x0000 to 0xFFFE.

            d) Resetting the disk system shouldn't be necessary before trying to read sector/s the first time (as you know the BIOS successfully read your boot loader and the disk system is working fine). It should only be used as an attempt to recover from disk errors. Note that (for floppy disks) resetting the disk system typically means recalibrating the drive which involves sending the heads back to "track 0".

            e) When there's errors reading from disk, sometimes they're temporary (e.g. due to floppy drive motor speed variations) and sometimes they aren't (e.g. "bad parameters", "floppy disk ejected", etc). Retrying several times (and resetting the disk system occasionally between attempts) is recommended for working around temporary problems (especially for floppy disks). Slamming the disk heads back and forth forever (with "reset/recalibrate, seek/read, reset/recalibrate, seek/read, ...) is an extremely bad way to deal with persistent problems. You need a counter to track how many times you've retried so that you can stop after a limited amount of attempts and display an error message. Don't forget that BIOS returns an error code, and using that error code to determine which error message to display can help you find bugs and also help normal users figure out what to do when there's a problem (e.g. if it's faulty hardware/dodgy floppy disk or a software bug).

            f) You have control flow problems. Specifically, you call reset but that code has no ret and falls through into the read_sector code; so call reset won't return unless the BIOS successfully reads the sector, and there's no point doing the call read_sector after the sector was already successfully read.

            g) If the read_sector code succeeds it will fall through to the code to print a string. Your code to print a string (the printf routine) will get characters from the memory at the address contained in DS:SI, but SI is never set to anything in the 1st sector (before its executed) so it will probably only ever print a random/undefined mess (most likely case is that the byte at the unknown address happens to be zero and nothing is printed). Also; after reading a byte with lodsb SI will either be incremented or decremented depending on how the "direction flag" was set. Your code doesn't set the direction flag to anything (e.g. no cld instruction anywhere); which means that there's an extremely small chance that your code might print a random string backwards ("!dlroW olleH"). I don't know if you intended to have a ret after the code to read a sector, or if you intended to set DS:SI to the address of a "2nd sector loaded!" string (I assume the former because there's no string in the 1st sector).

            h) The contents of the second sector starts with a string ("now there is a different message!"). If there were no other bugs, call sector (in 1st sector) would have caused this string to be executed and not valid code (likely causing a spectacular crash of some sort). You want to either move the string somewhere else (after the code in the second sector) or jump to the code directly (e.g. a jmp sector2_code in the 1st sector and a sector2_code: label before the mov si, message instruction).

            i) The BIOS function you're using to read sectors mostly doesn't work for hard disks (modern hard disks are simply too big - there's an "extended disk read" function you'd want to use instead). For floppy disks you can't use the "extended disk read" function (and have to use the BIOS function that you are using). For other cases (booting from USB flash, booting from a CD configured to emulate something) you will need either a "BIOS Parameter Block" (see https://en.wikipedia.org/wiki/BIOS_parameter_block ) for floppy and floppy emulation, or a partition table (for hard disk or hard disk emulation). For actual real floppy disks, the "BIOS Parameter Block" is technically optional (originally part of the FAT file system and nothing to do with the BIOS at all), but it's common for other operating systems (Windows) to complain about the disk not being valid/formatted if there is none (which really confuses normal users).

            j) Windows is malware that can/will corrupt 4 bytes in the first sector of a disk (in the middle of your boot sector's code), even though Windows has no right to tamper with competing operating system's disks or boot loaders. Specifically, Microsoft decided that Windows should use a unique disk signature to identify disks, so when Windows first sees a disk it will try to fetch this unique signature and if the value isn't unique it will write a new "unique" value at offset 0x01B8 in the first sector. Note that this behaviour was "retro-actively" included in the UEFI specs in the section relating to (the "protective MBR" part of) the GPT partitioning scheme (where it doesn't apply to unpartitioned disks, MBR partitioned disks or people using BIOS instead of UEFI); and in the UEFI specs it's considered optional (the literal words are "This may be used by the OS...") and there's no clear guidance of which OS (yours or Microsoft's ) gets to decide if the signature is present or not (or how the signature should be generated to allow operating systems to agree on a "unique" value and prevent it from being modified every time a different OS sees the disk). In any case; you want to avoid using the 4 bytes at offset 0x01B8 in your boot sector to defend yourself from Windows.

            Source https://stackoverflow.com/questions/67613202

            QUESTION

            Getting C to wok with assembly
            Asked 2021-May-18 at 17:37

            Im working on a simple OS, for the past 3 weeks ive been debugging an error that only arrises when i call c++ or c code in assembly, qemu (the emulator im using), will start flickering and wont load code. I have already tried this with other emulators.

            "Bootloader.asm"

            ...

            ANSWER

            Answered 2021-May-16 at 23:59

            like @jester commented your question. You seem to compile your bootloader as .code32. Your CPU(qemu or any other VM) won't boot it, cause CPU originally runs in 16bit mode. Please take a look here - JOS bootloader . This is minimalistic bootloader you might learn from.

            Source https://stackoverflow.com/questions/67562479

            QUESTION

            STM32H7, weird behavior of HAL_FLASH_Program function
            Asked 2021-May-12 at 09:11

            For the context, I'm writting a bootloader for my STM32H743XI cause I want to erase and upload code through USB without using pin.

            So my bootloader start at 0x08000000, it's size is 21kB (17% of the first sector of 128kB), and I want to read/write data at the end of the sector which will be shared with my App. When I say end of the sector it's the last 10kB of the sector which means I start to R/W at 0x0801D800.

            The structure that I want to R/W is 8x32bits cause if I understand well this is the size of a WORD on STM32H74x/5X devices.

            This is my struct:

            ...

            ANSWER

            Answered 2021-May-12 at 09:11

            Ok it's seems that it is impossible to write two time in a row at the same adress, i've read somewhere that we are only allow to switch a bit from 1 to 0 if we want to write multiple time without erasing. I moved my "shared area" in a specific sector that I have to erase each time I want to write on it.

            My problem is solved.

            Source https://stackoverflow.com/questions/67422054

            QUESTION

            Why do we need ORG 0x7c00 at the beginning of a bootloader?
            Asked 2021-May-05 at 00:32

            In every bootloader code that I've seen, there's this line "ORG 0x7c00" at the beginning of the file. As far as I know, BIOS will put this code at address 0x7c00.

            So what is the reason of doing the "org 0x7c00"? Isn't it true that if the first instruction is loaded into 0x7c00, the counter will automatically start from there? Isn't the address of every instruction 0x7c00 + offset anyway?

            ...

            ANSWER

            Answered 2021-May-05 at 00:32

            If you have the following code:

            Source https://stackoverflow.com/questions/67393581

            QUESTION

            NASM: invalid combination of opcode and operands in a %include file, reported line number is past the end?
            Asked 2021-May-01 at 06:51

            I'm building a simple OS and am trying to just get some text on the screen, from the bootloader.

            Whenever I compile it (nasm -fbin bootloader.asm), it gives this error:

            print.asm:23: error: invalid combination of opcode and operands

            I can't understand what's wrong, and print.asm doesn't even have that many lines, so it's not clear which line NASM doesn't like.

            This is the bootloader.asm:

            ...

            ANSWER

            Answered 2021-May-01 at 06:51

            nasm -fbin print.asm reveals the actual line number, 11.

            int bx isn't an instruction. Typo for inc.

            I think NASM's line number after a %include is probably overall line since the start of the main file, which is a bug in NASM 2.15.05 (at least). In this case your file can assemble separately to see what's wrong, but other cases would be less easy. The bug has already been fixed in NASM 2.16rc0, and may get backported to 2.15.xx. https://bugzilla.nasm.us/show_bug.cgi?id=3392731

            Apparently this also affects debug info line-numbering. e.g. for setting breakpoints in GDB by source line number. It of course always works to b *0x1234 with a copy-pasted address from disas output, that doesn't care about debug info.

            yasm -fbin bootloader.asm gets the line numbering correct: print.asm:11: ... with the same invalid combo message as NASM. That's from yasm 1.3.0. Unfortunately YASM isn't being developed anymore (?), and hasn't kept up with new instructions like AVX-512, but it's usable for stuff like bootloaders.

            The bug is also not present in some older versions of NASM, for example 2.11.05 from 2014 reports print.asm:11. I don't have versions between that kicking around to bisect when this bug was introduced.

            Source https://stackoverflow.com/questions/67343458

            QUESTION

            Why am I not receiving interrupts on Port Status Change Event with the Intel's xHC on QEMU?
            Asked 2021-Apr-26 at 06:13

            I'm coding a small OS kernel which is supposed to have a driver for the Intel's xHC (extensible host controller). I got to a point where I can actually generate Port Status Change Events by resetting the root hub ports. I'm using QEMU for virtualization.

            I ask QEMU to emulate a USB mouse and a USB keyboard which it seems to do because I actually get 2 Port Status Change Events when I reset all root hub ports. I get these events on the Event Ring of interrupter 0.

            The problem is I can't find out why I'm not getting interrupts generated on these events.

            I'm posting a complete reproducible example here. Bootloader.c is the UEFI app that I launch from the OVMF shell by typing fs0:bootloader.efi. Bootloader.c is compiled with the EDK2 toolset. I work on Linux Ubuntu 20. Sorry for the long code.

            The file main.cpp is a complete minimal reproducible example of my kernel. All the OS is compiled and launched with the 3 following scripts:

            compile

            ...

            ANSWER

            Answered 2021-Apr-26 at 06:13

            I finally got it working by inverting the MSI-X table structure found on osdev.org. I decided to completely reinitialize the xHC after leaving the UEFI environment as it could leave it in an unknown state. Here's the xHCI code for anyone wondering the same thing as me:

            Source https://stackoverflow.com/questions/67206312

            QUESTION

            x86-64 Kernel crashing on setting up the IDT
            Asked 2021-Apr-23 at 16:11

            I am currently trying to create an x86-64 Kernel from scratch (using GRUB Multiboot2 as a bootloader). I set up my GDT just fine, but when setting up my IDT, there seems to be a problem. I isolated the issue to be my call of lidt by hlting before and after most instructions of my code. Here are my C and ASM files that define my IDT:

            ...

            ANSWER

            Answered 2021-Apr-23 at 15:39

            Your load_idt function is written as a 32-bit function where the first parameter is passed on the stack. In the 64-bit System V ABI the first parameter is passed in register RDI. Use this instead:

            Source https://stackoverflow.com/questions/67231295

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install bootloader

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/particle-iot-archived/bootloader.git

          • CLI

            gh repo clone particle-iot-archived/bootloader

          • sshUrl

            git@github.com:particle-iot-archived/bootloader.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Change Data Capture Libraries

            debezium

            by debezium

            libusb

            by libusb

            tinyusb

            by hathach

            bottledwater-pg

            by confluentinc

            WHID

            by whid-injector

            Try Top Libraries by particle-iot-archived

            particle-dev

            by particle-iot-archivedJavaScript

            docs-old

            by particle-iot-archivedCSS

            core-communication-lib

            by particle-iot-archivedC++

            core-common-lib

            by particle-iot-archivedC

            cc3000-patch-programmer

            by particle-iot-archivedC++