I noticed these stones whenever I visit Osaka Castle but I never knew there significance till recently.
The stones are called “残念石”.
残念 (Zannen) means differently in how you use it , but in general it means, “regret” or “disappointment”.
石 (Ishi) : means stone.
Each of these stones where taken from a quarry site all the way to the castle site but sometimes during the transportation accidents happens, like dropping of the stone to the ground, a crack which is no longer considered perfect or acceptable for the construction Castle so they are abandoned somewhere in the ground and are called since then as “Zannen Ishi”. Each piece of stone must be perfect anything less is not acceptable.
It’s an interesting story or piece of history about the stone. When I googled it , it looks like these stones are not only found in Osaka Castle but several places as well. [Here(Japanese Only)].