Probable cause for chasing and searching him. Which, imho, is why 4th amendment violation (i.e., illegal search and seizure) was not included in the charges.
There's two stories, but it doesn't matter which one is true, if you run from the police in a "high crime rate" area (this is one of the worst in Baltimore), the police can stop, question and search you. Which they did. But, you can not arrest them for this, it's not a crime. That's where the knife comes in. The knife could be the crime.
Story One, Freddie was just hanging out and he made eye contact with the officer and ran.
Story Two, Freddie was in the middle of a drug deal, and when he made eye contact with the officer he ran.
Which is true? Who knows. But, I'm guessing the eye contact and running is true, because Mosby did not argue it during her speech.