Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save timbrom/1942280 to your computer and use it in GitHub Desktop.
Save timbrom/1942280 to your computer and use it in GitHub Desktop.
Patch for stlink issue 65
From 7341a316c38a61cc745ce04e618916677007883b Mon Sep 17 00:00:00 2001
From: Timothy Brom <thb@timbrom.com>
Date: Wed, 29 Feb 2012 11:29:55 -0500
Subject: [PATCH] Fixed error about strexh and strexb using the same register
---
example/libs_stm/inc/core_support/core_cm3.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/example/libs_stm/inc/core_support/core_cm3.c b/example/libs_stm/inc/core_support/core_cm3.c
index 56fddc5..0e8c3c4 100644
--- a/example/libs_stm/inc/core_support/core_cm3.c
+++ b/example/libs_stm/inc/core_support/core_cm3.c
@@ -733,7 +733,7 @@ uint32_t __STREXB(uint8_t value, uint8_t *addr)
{
uint32_t result=0;
- __ASM volatile ("strexb %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) );
+ __ASM volatile ("strexb %0, %2, [%1]" : "=&r" (result) : "r" (addr), "r" (value) );
return(result);
}
@@ -750,7 +750,7 @@ uint32_t __STREXH(uint16_t value, uint16_t *addr)
{
uint32_t result=0;
- __ASM volatile ("strexh %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) );
+ __ASM volatile ("strexh %0, %2, [%1]" : "=&r" (result) : "r" (addr), "r" (value) );
return(result);
}
--
1.7.5.4
@strain1
Copy link

strain1 commented Nov 4, 2016

thanks works fine

@genzj
Copy link

genzj commented Aug 25, 2017

It works for me. Thanks a lot 👍

@wajatimur
Copy link

Big help, Thanks!!

@souravg009
Copy link

I manually changed the values. Worked like charm. but how to apply the patch?

@WulfricLee
Copy link

That works!!! 😀 How did you figure out this!!!

@hotsauce1861
Copy link

great,Thanks a lot!!!

@bactone
Copy link

bactone commented Sep 6, 2023

thanks, works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment