I have made an encryption function, that i use for both a windows program and on a microcontroller (STM32G431). It works as expected on windows, but on the chip it doesnt.
It use multiple bit shift and XOR. I already casted the function parameters to what they should be, but it still does not work.
What else could also be different on these two systems?
I already casted the function parameters to what they should be
Sounds dodgy - why would you need to cast them? Are they not properly defined?
Other than that, there is absolutely zero to go on here. Some code where it is failing would be useful. Even just saying what language and which compilers you're using would be a help!
Windows is probably 64-bit, but that's so obvious and you surely aren't using 64-bit ints on Windows and casting to 32-bits on the STM. Has it worked previously on some other micro? Another desktop OS? Go on, give us some info...
Show the code.
Generally, use stdint.h stuff and be careful with integer promotion rules.
I have made an encryption function, that i use for both a windows program and on a microcontroller (STM32G431). It works as expected on windows, but on the chip it doesnt.
It use multiple bit shift and XOR. I already casted the function parameters to what they should be, but it still does not work.
What else could also be different on these two systems?
If you need casting function parameters, then you are likely looking at alignment issues. Look whether the code accesses data to be encrypted in chunks more than 1 byte long. If so, this code is likely not portable.
I found the problem: just a few inches in fron of the screen
I was so focused on my encryption function, that i did not check the parameters that were coming in. Guess what... Sometimes you got to focus, but sometimes you should not at all!