STM32F4DIS-BB + RTOS httpserver_socket example - freertos

I try example from ST for baseboard STM32F4DIS_BB + STM32F4-discovery.
I want to use RTOS example httpserver_socket. Before I use standalone (NO RTOS) httpserver example without problems. But in RTOS example the server was freeze on every web connection. It means that task are OK for LED toggle,DHCP is OK etc. Ping from CMD is OK. But when I make connection from web client the board was freezed and go to HardFault_Handler().
Any opinion?

Have you tried debugging the hard fault to see which instruction caused it? Once you know that you will be able to place a break point in the code to see how you got there.
As an aside, we have FreeRTOS+TCP running on an STM32F4 now, but on the larger eval board, rather than the Discovery board.

thanks to Richard. I found by debug and CFSR register that problem is in mem management :
"processor attempted an instruction fetch from a location that does
not permit execution. This fault occurs on any access to an XN region,
even when the MPU is disabled or not present"
But I dont understand how can ST make example for the same hardware what I have with this error? Now I try to find a problem.

I found that problem is in FPU option in project setting. Original project has set use FPU .When I set not used then project are OK. Problem in use of FPU and freeRTOS .

Related

AHB AP transaction error with zynq board

I'm new at zynq board. I am trying to work with XADC of zynq-xc7z020 and want to see its quality for my application through vivado and xilinx SDK.
I tested two ways of designing through lab3 and lab4 tutorials. Synthesis, implementation and generating bitstream are OK in vivado. in the Xilinx SDK, after programming of the board, when I run a simple printf through system debugger or GDB but I get "AHB AP transaction Error". I googled it a lot and spent few days for it, but didn't get any solution. Additional, I tried to connect to the arm core of the board through XMD console by "connect arm hw" command. but console get JTAG connection error, while JTAG cable is connected and programming of the board is done.
suggested solutions of here didn't help.
thank you.
I understand what my mistake was.
Through XSCT console in SDK, I run mrd command to access DDR and read its address. but I couldn't. So I got that the problem was from DDR configurations.
I create a new project and at the first step of designing, after adding ZYNQ7 Processing System to block design, click on 'run block automation' and continue all previous steps and it worked. The point was that automation run. It sets some auto configuration of block that have to be set; and my mistake was this, that I connected DDR port manually.

Why is FreeRTOS windows demo failing when creating the IDLE task?

I'm starting with FreeRTOS and I'm trying to debug the Windows Demo. It compiles just fine but when I'm stepping in the code I can see that the assert inside the xTaskGenericCreate is being generated when FreeRTOS is trying to create the idle task.
I don't know why this is hapening since I haven't modified the original demo code.
Could anyone help me with this?
Regards
If you could say which assert was hit I could probably tell you right away what the issue is.
Is this the Windows project form the main FreeRTOS kernel download? Is it the Visual Studio or MingW/Eclipse version (https://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html)? Did you make any changes at all, even if you think they are minor?

How can I use FastMM4 memory leak reporting in a Service?

Does the same technique which FastMM4 for Delphi provides to report memory leaks to a detailed file work if the application runs as service? Of course the best practice would be to write unit tests and a simple standalone application first, and find the leaks there, outside the service environment.
As Lars Truijens notes, writing to a log file requires file system privileges. The default Local System account (i.e. when you do not set an account explicitly or logon in your code) has full access to the local file system but has no default network access.
FWIW - I typically develop my services as regular Windows apps until the main part of the logic is up and running and stable. Using a library like SvCom allows you to run your services as a regular desktop application or as a service without any code changes.
Yes, provided the account used to running the service has enough rights to write the log file.
I am having the same challenge at the moment. I tried this, but it does not work, at least so far for me. There are sufficient rights for the account, since the service can write his own proprietary logfile. I have switched on FullDebugMode and added the dll, I have switched on LogMemoryLeakDetailToFile, both via the IDE options. In the code I see that the right areas are seen by the compiler, when I provoke an error for example, the compiler reports it. Also I cannot debug the FastMM code. If I put a breakpoint it is ignored. I have searched all my local hard disks where that report might be gone to, it is not to be found. I start and stop the service from 'Administration-Services', all goes well, it starts up, but no report. If I do the same with a normal executable, all goes well. I am using FastMM478, and Delphi2007.
Marc
Ok I found out another reason why sometimes you cannot see any output, logfile or messagebox......
If you do not make any error, it does not create any output.
So to test if FASTMM478 works deliberately make an error in your program like:
//Create and to NOT destroy
testToMakeError := TStringList.Create;
for I := 0 to 100 do
testToMakeError.Add('foobar');
I just presumed I would have made some error somewhere and spend a day trying to find out why the program did not gave me any feedback.
Marc
Do the instructions as described in the readme file for FastMM
Enable {.$define NoMessageBoxes} in FastMM4Options.inc File
Disable {$define RequireDebuggerPresenceForLeakReporting} in FastMM4Options.inc File
Install/Start Service and after stopping it you will get MyApp_MemoryManager_EventLog File in output folder.

Debugging Delphi Application on Non Development Environment

I am attempting to use WinDBG or another debugger to debug a CodeGear Delphi 2007 Windows application on a remote machine. I have been unable to produce symbol files for WinDBG.
Is there a way to use WinDBG or another debugger to debug Delphi applications on a system that doesn't include the IDE?
Edit1
The remote debugger is not an option here. I am able to remote in to the end user PC, but I am unable to use the remote debugger due to firewall restrictions.
Edit2
I am able to remote in to the machine, but can not connect the CodeGear remote debugger due to firewall restrictions.
How about the remote debugger? Build your app with remote debug symbols and debug from your development machine across the network.
instead, i rely on MadExcept stack tracing and some logging features. my application is distributed worldwide & this has been sufficient.
You can try generating a map file and then convert it to a dbg file using map2dbg from
http://code.google.com/p/map2dbg/
Then you can load the dbg file in WinDbg.
Disclaimer: I had faced a similar issue but I managed to do remote debugging and didn't have to do all this. So I am not sure this will work. But if you try it then do let us know if it works.
I'm afraid this is one more of those "I don't have an actual answer" answers, but it might just help...
Have you considered adding logging to your application? I've heard great things about SmartInspect. With it, you can log all sorts of information, including stack traces and "watches" (variables).
Another logging product for Delphi is EurekaLog.
In Delphi you could use Run -> Attach to Process, select the remote machine and select the process you'd like to debug.
http://sourceforge.net/projects/tds2dbg/ can be used to convert Delphi's TDS debug files to DBG files. This gives basic symbol information -- functions, classes, units, but not variables. Enough for a reasonable call stack, and with a bit of knowledge, enough to debug Delphi apps live and with dumps.
I've written about some of Delphi+WinDBG experiences on my blog: https://marc.durdin.net/2015/11/windbg-and-delphi-a-collection-of-posts/
Thank you all for the great suggestions and interesting products.
To solve this specific issue, the "best" way I found uses the OutputDebugString located in the Windows namespace. This, along with Debug View from Sysinternals, will allow me to gather debug information and sort through it pretty quickly.
If you decide to use this method, make sure everything is wrapped in ANSI formatting. IE:
OutputDebugString(PAnsiChar(string1 + string2));
This makes sure that string1 and string2 are combined and then converted in to ANSI Characters.
I probably should have just started dumping text to a file for something quick and dirty, but this will allow a non-debugging version to emit debugging messages.

Delphi Keyboard Hook

I'm having an interesting problem implementing a global keyboard hook.
I wrote a dll which is used to set the hook and then an application (Delphi) which loads the dll and processes the results of the hook. This was done this afternoon on my PC at work and after some testing I figured it was working 100%.
I've just tested the same app and dll here at home and I'm not getting any errors, but the application does not appear to be getting any data either.
Both machines are WinXP, although my work machine is SP2 and this one is SP3.
Has there been some change in the Win32 API which would cause this to malfunction, or could the problem be related to some A/V / Spyware / MS Update that has been released recently?
I'm hoping somebody here will know of an obvious reason that this may happen before I spend hours debugging.
Thanks!
Actually some A/Vs don't like homemade hooks. I've got the same problem with my mouse hooker on some machines, and it doesn't depend on service pack version.
Yeah, I could. I haven't installed Delphi on this machine, but I think I might have to. I'm going for the low hanging fruit here. If there's an obvious answer, there's no need to go through all the trouble of debugging and hoping to find what might be the problem.
My first suspicion is that there's been a change in the API somewhere.
As I mentioned, this app works absolutely perfectly on my work machine.
Do you have a debugger on your home computer? Do you receive any messages via the hook at all?
Can it be that some other application is hooking, and don't pass the message on down the hook-chain?
BTW: I love virtual machines for this kind of testing. Keep a clean XP install. Install SP2, and test your application. Roll back to clean install again, and install SP3. Try your application again. This way you will know if its SP3, since there is nothing else to mess things up. I like to keep a set of snapshots around with different configurations.
Which kind of hook are you using? I once used the WH_CBT-type and encountered problems when certain other applications where running. One case I could trace back to Trillian, which seems to do also some kind of hooking (and maybe screws up).
Apart from that I am currently working on an application that uses the WH_KEYBOARD-hook and this works on SP2 and SP3 equally well. The MSDN also doesn't mention any service-pack related changes.
What you can do to trace the bug on your home machine:
make sure to check all result values of all system api calls (and use GetLastError in case of error)
provide some kind of debug output in case of error (e.g. as message box or to a text file)
optional: log some status messages so you know whats going on internally
One alternative is to use a low level keyboardhook. (Just a different param to SetWindowsHookEx). The hook is processed in the message loop of the registering thread, and thus does not need to inject a dll everywhere. And for some odd reason VirusScanners/Firewalls interfere much less with it. They often silently block dllinjection or normal keyboardhooks. Also removes the need to share the hHook across processes if you want it to work in older windows versions.
And if you abuse a keyboardhook to implement global hotkeys(Have seen that a lot) use RegisterHotkey/http://msdn.microsoft.com/en-us/library/ms646309.aspx) instead.

Resources