I have no code in mind right now. I just want to get started with a blinky perhaps. it’s been 2 years since I last coded. the board is an Iranian custom made board from an electronics shop. stm baords are insanely expensive here. it came with the schematics and all. since it’s in persian if you’re intrested in any spicific thing I can translate it but honestly that’s all it says. it included a lot of example keil projects but again nothing on how to use it in other IDEs

If it’s an STM chip I suggest using any of the available normal frameworks (Arduino, STM32HAL, mbed-os) instead trying to do a bare-metal project. I’ve never heard of a NO_CPR register or something and google yields 0 results for "NO_CPR" stm32.

What chip does the board have? Are you programming it via SWD and a ST-Link probe? Can you upload the schematics?

when I plug the board to my PC it reads as a USB flash drive. I paste the .hex there and unplug it. maybe I should save for a proper stm board. they’re very expensive sadly any recommendations? I think an m3 is enough for a noob like me

If it’s a flash drive it probably has a DAP-Link debug probe on board or the chip opens up a file system. I think your board is fine, you just have to show me the board schematics and I can tell you what how to create a project for it.

Sure! thank you for helping me here are both the schematic files I found on the drive. I think the (REV_C) file is the optional board that it plugs into that has all sorts of buttons LCD inputs etc. BUt I uploaded it just in case. it functions just as well without that board (I didn’t have it at first in fact)

But we also need to change the RAM ( IRAM1) and FLASH (IROM1) offsets according to the manual (why is this necessary? no idea…) This is done by a custom linker script found at the bottom. Save it to some path on your computer.

You need to change the path C:/Users/... to the path where you have downloaded the linker script. It must be an absolute path.

You should then try to just press the upload the button, it will try CMSIS-DAP. If that doesn’t work try adding upload_protocol = mbed to make it place the firmware.bin on the microcontroller. If that still doesn’t work, you can go into your project folder under .pioenvs\lpc1768\firmware.bin, there is the firmware file which you can drag on the USB drive.

The reason for the changed start offset is very likely that the chip has been programmed with its own custom bootloader (at 0x0), so we should not overwrite it if we want to keep programing the board via USB. See http://www.keil.com/support/docs/3876.htm. The problem is that the startup file in the mbed Framework doesn’t use the NO_CRP macro, it doesn’t touch CRP. Some other startup files do (example). So it could be that the device can be programmed only once via USB. I would just buy a JTAG programmer (example J-Link) and progarm the board normally without a special bootloader or changed offsets.

This is very late but THANKS IT WORKS
Is there a way I can avoid the mbed and use just native code or cmsis or whatever? i ahve no idea what to choose as a beginner. MBED seems to be spicific to a spicific board.

I sent you a ebay link above for a JLink programmer. Although, when I think about it, the chip should be capable of being programmed via SWD, so you might even be able to use a ST-Link to do it? (It’s not restricted to STM32 chips, I’ve also programmed a Realtek and a Nordic nRF52 chip with it)